syntax_analyzer
v0.0.2
Published
Syntax analyzer for Russian based on context-free grammar. Adoption of Constantin Constantinov's python project
Downloads
12
Maintainers
Readme
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']