olinox 7 tahun lalu
melakukan
310f1b4c9d

+ 17 - 0
.project

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>nestor</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>

+ 8 - 0
.pydevproject

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?><pydev_project>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/${PROJECT_DIR_NAME}</path>
+</pydev_pathproperty>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python36</pydev_property>
+</pydev_project>

+ 4 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//resources/benchmark.py=UTF-8
+encoding/<project>=UTF-8
+encoding/nestor.py=UTF-8

+ 19 - 0
nestor.py

@@ -0,0 +1,19 @@
+from textblob import TextBlob
+
+txt = "Tu es Nestor. Me comprends-tu?"
+blob = TextBlob(txt)
+
+if blob.detect_language() == "fr":
+    blob = blob.translate(from_lang="fr", to='en')
+
+print(blob.tags)
+
+
+
+# from textblob import Blobber
+# from textblob_fr import PatternTagger, PatternAnalyzer
+# tb = Blobber(pos_tagger=PatternTagger(), analyzer=PatternAnalyzer())
+#
+# blob = tb(txt)
+#
+# print(blob.tags)

+ 9 - 0
requirements.txt

@@ -0,0 +1,9 @@
+#spacy
+#python -m spacy download en
+#python -m spacy download fr
+#Microsoft Visual C++ 14.0
+
+
+textblob
+# python -m textblob.download_corpora
+textblob-fr

TEMPAT SAMPAH
resources/__pycache__/textblob.cpython-36.pyc


+ 33 - 0
resources/benchmark.py

@@ -0,0 +1,33 @@
+import time
+
+from textblob import TextBlob
+
+import en_core_web_sm
+
+blobs = ("Your name is Nestor.",
+         "Your name is Nestor. Do you understand me?",
+         "Your name is Nestor. Do you understand me? Dans la mythologie grecque, Nestor (en grec ancien Νέστωρ / Néstôr) est le plus jeune des fils de Nélée et de Chloris, roi de Pylos. Il en est le seul survivant après le massacre par Héraclès de tous ses frères. Deux traditions diffèrent pour expliquer qu'il ait survécu au triste destin de sa fratrie : soit qu'il ait été élevé à Gérénia, en Messénie, loin de ses frères, soit que lui seul ait refusé de participer à la tentative de vol des bœufs de Géryon, péniblement escortés par Héraclès, perpétrée par Nélée et ses onze autres fils. En échange le héros lui aurait épargné sa vie et fait de Nestor le roi de Messénie.")
+
+def test(blob):
+    t0 = time.time()
+
+    wiki = TextBlob(blob)
+
+    print(wiki.tags)
+    print(time.time() - t0)
+    t0 = time.time()
+
+    nlp = en_core_web_sm.load()
+    doc = nlp(blob)
+
+    for token in doc:
+        print(token.text, token.tag_)
+
+    print(time.time() - t0)
+
+for blob in blobs:
+    test(blob)
+
+
+# textblob: 0.13; 0.009; 0.03
+# spacy: 3.45; 3.29; 3.32

+ 36 - 0
resources/notes.txt

@@ -0,0 +1,36 @@
+
+FONCTIONNALITES DE BASE
+
+* Bot
+https://worldwritable.com/natural-language-processing-for-programmers-90c4e04dc6de#.ghs8io8vs
+https://apps.worldwritable.com/tutorials/chatbot/
+https://github.com/lizadaly/brobot/
+https://textblob.readthedocs.io/en/dev/quickstart.html
+
+
+*deep learning
+https://medium.com/artists-and-machine-intelligence/adventures-in-narrated-reality-6516ff395ba3#.yunr66ch3
+
+* Reconnaissance vocale
+ https://pypi.python.org/pypi/SpeechRecognition
+ https://pythonspot.com/speech-recognition-using-google-speech-api/
+
+* Identification vocale
+ https://github.com/korylprince/pygvoicelib
+ https://www.quora.com/What-are-the-best-voice-authentication-APIs-that-I-can-use
+
+* Synthese vocale (facultatif)
+ https://github.com/RapidWareTech/pyttsx
+ https://pythonprogramminglanguage.com/text-to-speech/
+
+Apis
+http://developer.wordnik.com/
+
+DIVERS
+
+Nestor: taches de base
+Hadock: Gestion projet, fichiers
+Tintin: recherche
+Tryphon: Organiseur de pensée
+Bianca: musique, son
+Dupond & Dupont

+ 32 - 0
resources/script.txt

@@ -0,0 +1,32 @@
+q: Ton nom? | Comment t'appelles-tu? | Qui-est-tu?
+a: Je suis Nestor, pour vous servir.
+
+q:
+a: 
+
+q: Montes le son | Augmentes le volume | Mets plus fort
+a: >>> Augmentes le volume de 10%
+
+q: Baisses le son | Diminues le volume | Mets moins fort
+a: >>> Diminue le volume de 10%
+
+q: Montes le son de X% | ...
+a: >>> Augmentes le volume de X%
+
+q: Baisses le son de X% | ...
+a: >>> Diminue le volume de X%
+
+q: Coupes le son
+a: >>> Coupe le son
+
+q: Encore
+a: >>> Répète la dernière action
+
+q: Met toi en veille | Fais dodo
+a: >>> Se ferme
+
+q: Silence | Pas de bruit
+a: Passe en mode silencieux
+
+
+

+ 11 - 0
resources/spacy_ex.py

@@ -0,0 +1,11 @@
+import fr_core_news_sm
+
+nlp = fr_core_news_sm.load()
+doc = nlp(u"Salut c'est nous! On revient de Paris.")
+
+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_)

+ 9 - 0
resources/textblob_ex.py

@@ -0,0 +1,9 @@
+from textblob import TextBlob
+from textblob.blob import Word
+
+wiki = TextBlob("Your name is Nestor. Do you understand me?")
+
+print(wiki.tags)
+
+w = Word("octopi")
+w.singularize()()