-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
39 lines (22 loc) · 826 Bytes
/
test.py
File metadata and controls
39 lines (22 loc) · 826 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
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SegMeant.SegMeant import SegmentedTextSM, SegMeant
import argparse
import sys
import os
import html
if __name__ == "__main__":
argparser = argparse.ArgumentParser(description="Analyse la similarité de deux fichiers textes.")
argparser.add_argument('input', help="Le texte à tokeniser.", type=str, default=[""], nargs='+')
args = argparser.parse_args()
text: str = args.input[0]
output = sys.stdout
f = open(os.devnull, 'w')
sys.stdout = f
sm = SegMeant()
doc = SegmentedTextSM(text, doc_name="test", lexicon=sm.LEXICON, model=sm.MODEL)
sys.stdout = output
f.close()
"""for i, token in enumerate(doc.listObjs):
print(f"{i}: {token.txt}\t{token.tags}<br>")"""
print(doc.serialize())