Преглед изворни кода

HPCC-27097 NLP Plugin: Fails to execute sample code

Signed-off-by: David de Hilster <david.dehilster@lexisnexisrisk.com>
David de Hilster пре 3 година
родитељ
комит
7102047dbe
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 2 2
      plugins/nlp/README.md
  2. 2 1
      plugins/nlp/nlp.cpp

+ 2 - 2
plugins/nlp/README.md

@@ -22,7 +22,7 @@ Import the nlp plugin library to analyze a text into its syntactic parse tree wh
 IMPORT nlp from lib_nlp; 
 
 text01 := 'The quick brown fox jumped over the lazy boy.';
-parsedtext01 := nlp.AnalyzeText('taiparse',text01);
+parsedtext01 := nlp.AnalyzeText('parse_en-us',text01);
 output(parsedtext01);
 
 text02 := 'TAI has bought the American Medical Records Processing for more than $130 million dollars.';
@@ -30,7 +30,7 @@ parsedtext02 := nlp.AnalyzeText('corporate',text02);
 output(parsedtext02);
 
 text03 := 'Right middle lobe consolidation compatible with acute pneumonitis.';
-parsedtext03 := nlp.AnalyzeText('taiparse',text03);
+parsedtext03 := nlp.AnalyzeText('parse_en-us',text03);
 output(parsedtext03);
 
 text04 := 'TAI\'s stock is up 4% from $58.33 a share to $60.66.';

+ 2 - 1
plugins/nlp/nlp.cpp

@@ -63,8 +63,9 @@ namespace nlp {
                 nlpEng = new NLPEng();
             }
         }
+        StringBuffer txtBuff(txtLen,txt);
         ostringstream sso;
-        tgtLen = nlpEng->nlpEngAnalyze(ana,txt,sso);
+        tgtLen = nlpEng->nlpEngAnalyze(ana,txtBuff,sso);
         tgt = (char *) CTXMALLOC(parentCtx, tgtLen);
         memcpy_iflen(tgt, sso.str().c_str(), tgtLen);
     }