@@ -19,22 +19,12 @@ class NlpController {
1919 private _secondaryNLP ;
2020 private _ready : boolean ;
2121
22- private test_list_pos : string [ ] ;
23- private nouns : string [ ] ;
24- private test_list_entities : string [ ] ;
25- private map : Map < string [ ] , string > ;
26-
2722 constructor ( ) {
2823 this . _ready = false ;
2924 this . _mainNLP = wink ( model ) ;
3025 this . _secondaryNLP = wink ( model ) ;
3126 this . _customPatterns = [ ] ;
3227 this . _secondaryCustomPatterns = [ ] ;
33-
34- this . test_list_pos = [ ] ;
35- this . test_list_entities = [ ] ;
36- this . map = new Map ( ) ;
37- this . nouns = [ ] ;
3828 }
3929
4030 injectPath ( pluginPath : string ) {
@@ -66,7 +56,7 @@ class NlpController {
6656 { name : "ordinalDateReverse" , patterns : [ " [|DATE] [DATE|may|march] [|DET] [ORDINAL]" ] } ,
6757 ) ;
6858 this . _customPatterns . push (
69- { name : "timeRange" , patterns : [ "[|ADP] [TIME|CARDINAL|NUM] [|am|pm] [|ADP] [TIME|CARDINAL|NUM] [|am|pm]" , "[TIME|CARDINAL] [-|/] [TIME|CARDINAL]" ] } ,
59+ { name : "timeRange" , patterns : [ "from [TIME|CARDINAL|NUM] [|am|pm] to [TIME|CARDINAL|NUM] [|am|pm]" , "[TIME|CARDINAL] [-|/] [TIME|CARDINAL]" ] } ,
7060 { name : "exactTime" , patterns : [ "[at|for] [CARDINAL|TIME]" ] }
7161 )
7262 this . _customPatterns . push ( { name : "intentionalVerb" , patterns : [ "[|AUX] [VERB] [|ADP] [|DET] [NOUN]" ] } ) ;
@@ -421,55 +411,6 @@ class NlpController {
421411 return eventTitle ;
422412 }
423413
424- test ( sentence : Sentence ) {
425- const text = sentence . value ;
426- const sentences = text . split ( "\n" ) ;
427- sentences . forEach ( sentence => {
428- const caseInsensitiveText = sentence . toLowerCase ( ) ;
429- const doc = this . _mainNLP . readDoc ( caseInsensitiveText ) ;
430- const testDoc = this . _secondaryNLP . readDoc ( caseInsensitiveText ) ;
431- const customEntities = doc . customEntities ( ) . out ( this . _mainNLP . its . detail ) ;
432- const secondaryCustomE = testDoc . customEntities ( ) . out ( this . _secondaryNLP . its . detail ) ;
433- console . log ( "customE" , customEntities ) ;
434- console . log ( "secondaryCustomE" , secondaryCustomE ) ;
435- const entities = doc . entities ( ) . out ( this . _mainNLP . its . detail ) ;
436- const dates = entities . filter ( e => e . type == "DATE" ) ;
437- const tokens = doc . tokens ( ) ;
438- const tokenValues = tokens . out ( ) ;
439- const pos = tokens . out ( this . _mainNLP . its . pos ) ;
440- console . log ( pos ) ;
441- pos . forEach ( ( p , i ) => {
442- if ( p == "PROPN" ) {
443- const corrispectiveToken = tokenValues [ i ] ;
444- const corrispectiveDateList = dates . filter ( d => d . value == corrispectiveToken )
445- if ( corrispectiveDateList . length > 0 ) {
446- pos [ i ] = corrispectiveDateList [ 0 ] . type ;
447- }
448- }
449- if ( p == "PUNCT" ) {
450- pos . remove ( p ) ;
451- }
452- if ( p == "NOUN" ) {
453- const corrispectiveToken = tokenValues [ i ] ;
454- this . nouns . push ( corrispectiveToken ) ;
455- }
456- } )
457- this . test_list_pos . push ( pos ) ;
458- this . map . set ( pos , sentence ) ;
459- } )
460- }
461-
462- print ( ) {
463- console . log ( "POS list" )
464- console . log ( this . test_list_pos ) ;
465- this . test_list_pos = [ ] ;
466- console . log ( Array . from ( this . map . entries ( ) ) ) ;
467- console . log ( "Nouns" )
468- console . log ( this . nouns ) ;
469- this . nouns = [ ] ;
470-
471- }
472-
473414}
474415
475416const nplController = new NlpController ( ) ;
0 commit comments