Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLP-ENGINE-423 add fetch attrs for punct and ctrl #501

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions lite/dicttok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,26 +772,18 @@ switch (typ)
// Put this as a variable on the node!
int ansi = (unsigned char) *str;
replaceNum(node,_T("CTRL"),ansi);
makeTextAttrs(node,last);
findTokAttrs(node,last,con,str,lcstr);
}
break;
case PNALPHA:
case PNEMOJI:
makeTextAttrs(node,last);
con = NULL;
if (str && *str) {
con = cg_->findWordConcept(str);
}
if (!con && lcstr && *lcstr) {
con = cg_->findWordConcept(lcstr);
}
findAttrs(node, con, str, false);
findTokAttrs(node,last,con,str,lcstr);
break;
case PNNUM: // Placed here for easy reference.
++totnums_;
// Fall through to PNPUNCT for now.
case PNPUNCT:
makeTextAttrs(node,last);
findTokAttrs(node,last,con,str,lcstr);
break;
case PNWHITE:
prevwh_ = true;
Expand All @@ -808,6 +800,18 @@ else if (root_) // Sanity check.
return node;
}

void DICTTok::findTokAttrs(Node<Pn> *node, Node<Pn> *last, CONCEPT *con, _TCHAR *str, _TCHAR *lcstr) {
makeTextAttrs(node,last);
con = NULL;
if (str && *str) {
con = cg_->findWordConcept(str);
}
if (!con && lcstr && *lcstr) {
con = cg_->findWordConcept(lcstr);
}
findAttrs(node, con, str, false);
}

void DICTTok::makeTextAttrs(Node<Pn> *node, Node<Pn> *last) {
if (prevwh_)
replaceNum(node,_T("SP"),1);
Expand All @@ -821,7 +825,6 @@ void DICTTok::makeTextAttrs(Node<Pn> *node, Node<Pn> *last) {
lines_ = tabs_ = 0;
}


inline bool DICTTok::findAttrs(Node<Pn> *node, CONCEPT *con, _TCHAR *str, bool isSuggested) {
_TCHAR attrName[NAMESIZ];
_TCHAR bufval[NAMESIZ];
Expand Down
1 change: 1 addition & 0 deletions lite/dicttok.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class DICTTok : public Algo
Htab *htab
);

void findTokAttrs(Node<Pn> *node, Node<Pn> *last, CONCEPT *con, _TCHAR *str, _TCHAR *lcstr);
void makeTextAttrs(Node<Pn> *node, Node<Pn> *last);

inline bool findAttrs(
Expand Down
2 changes: 1 addition & 1 deletion nlp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All rights reserved.
#include "lite/nlp_engine.h"
#include "version.h"

#define NLP_ENGINE_VERSION "2.12.0"
#define NLP_ENGINE_VERSION "2.12.1"

bool cmdReadArgs(int,_TCHAR*argv[],_TCHAR*&,_TCHAR*&,_TCHAR*&,_TCHAR*&,bool&,bool&,bool&);
void cmdHelpargs(_TCHAR*);
Expand Down
Loading