-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinference.py
More file actions
31 lines (22 loc) · 783 Bytes
/
Copy pathinference.py
File metadata and controls
31 lines (22 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# small script to try out the LSR model
# usage: python3 inference.py [words...]
import sys
from lsrmodel import Model
model = Model() # load once, reuse
def show(word):
print(f"\nInput: {word}")
results = model.analyse(word)
if not results:
print(" (no analysis)")
return
for i, r in enumerate(results, 1):
print(f" [{i}] lemma={r['lemma']} stem={r['stem']} root={r['root']}")
print(f" pos={r['pos']} paradigm={r['paradigm']} tags={r['tags']}")
print(f" source={r['source']}")
if __name__ == '__main__':
words = sys.argv[1:]
if not words:
words = ['ആന', 'ആനകൾ', 'മരം', 'മരങ്ങൾ']
print("Model info:", model.info())
for w in words:
show(w)