소스 검색

corrections mineures

olivier.massot 7 년 전
부모
커밋
b51bd85837
3개의 변경된 파일16개의 추가작업 그리고 13개의 파일을 삭제
  1. 2 1
      .gitignore
  2. 12 1
      core/nlp.py
  3. 2 11
      nestor.py

+ 2 - 1
.gitignore

@@ -4,4 +4,5 @@
 .settings/
 temp/
 test/
-output/
+output/
+*.log

+ 12 - 1
core/nlp.py

@@ -1,4 +1,15 @@
 import fr_core_news_md
 
 
-nlp = fr_core_news_md.load()
+nlp = fr_core_news_md.load()
+
+
+def repond(message):
+    doc = nlp(message)
+
+    for token in doc:
+        print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
+              token.shape_, token.is_alpha, token.is_stop)
+
+    for ent in doc.ents:
+        print(ent.text, ent.start_char, ent.end_char, ent.label_)

+ 2 - 11
nestor.py

@@ -4,15 +4,6 @@ from core.nlp import nlp
 
 logger = logging_.getLogger("nestor")
 
+while True:
+    nlp.repond(input(">"))
 
-instr = ""
-while instr != "exit":
-    instr = input(">")
-    doc = nlp(instr)
-
-    for token in doc:
-        print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
-              token.shape_, token.is_alpha, token.is_stop)
-
-    for ent in doc.ents:
-        print(ent.text, ent.start_char, ent.end_char, ent.label_)