-
Notifications
You must be signed in to change notification settings - Fork 0
/
tr_parse.py
24 lines (18 loc) · 718 Bytes
/
tr_parse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import argparse
from tr_syntactic_parser.tools.helper import *
from tr_syntactic_parser.tr_parser import TurkishCKYParser
parser = argparse.ArgumentParser(
prog="TR CKY Parser",
description="CKY parser to parse Turkish Sentences with predefined CNF rules",
epilog="For any purpose please connect me at [email protected]")
parser.add_argument("-s", dest="sentence", type=str, required=True)
args = parser.parse_args()
sentence = args.sentence
sentence = preprocess(sentence)
filename = "tr_syntactic_parser/grammar/grammar.txt"
parser = TurkishCKYParser(filename)
parser.parse(sentence)
parser.show_cky_chart()
print("##### BEST SENTENCE STRUCTURE #####")
parser.show_sentence_structure()
print()