syntax_analyzer

0.0.2 • Public • Published

Syntax Analyzer

Node.js adoption of https://github.com/constantin50/syntax_analyzer

This is syntax analyzer for Russian based on context-free grammar. It uses OpenCorpora dictionary of labelled words and AZ module as interface.

The repository consitsts of two main parts:

(1) parse_tree - class of binary tree to represent structure of sentence

(2) analyzer - parser that takes raw sentence and returns set of possible parse-trees

There are also complements:

grammar.json - context-free grammar for russian

dict - dictionary of some complex phrases (conjugations, predicatives, adverbs etc.) that don't present in OpenCorpora dictionary.

Example:

node run.js "Я пишу письмо старому другу"

S     
   NP[case='nomn'] 
       
       Я ['NPRO', 'sing', '1per', 'nomn']
       
VP[tran]
 
 VP[tran]
           
           VP[tran] 
                   
                   пишу ['VERB', 'sing', '1per', 'tran', 'pres']
           
           NP[case='accs'] 
                   
                   письмо ['NOUN', 'sing', 'neut', 'accs']
 
 NP[case='datv']
           
           NP[case='datv'] 
                   
                   старому ['NOUN', 'sing', 'neut', 'datv']
           
           NP[case='datv'] 
                   
                   другу ['NOUN', 'sing', 'datv']

Package Sidebar

Install

npm i syntax_analyzer

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

49.1 kB

Total Files

8

Last publish

Collaborators

  • ratinparadise