Exemple #1
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** NAMED ENTITIES RECOGNITION ************************************/
#
#  This example shows how to query Gurunudi to extract named entities in a text
#
#***************************** NAMED ENTITIES RECOGNITION ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.named_entities(
    "Larry Page was doing his Phd at Stanford University in 1996.")
print(response)

response = ai.named_entities("Emmanuel Macron est le président de la France.",
                             lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for named entities recognition visit https://guruyuga.com/languages/
Exemple #2
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** TRANSLATION *******************************************/
#  
#  This example shows how to query Gurunudi to translate a given text from one language to another
#  
#***************************** TRANSLATION *********************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai=AI()

#translation requires target language and source language to be specified
response = ai.translate("India is the only country to have an ocean named after it.",lang.SPANISH,lang.ENGLISH)
print(response)

response = ai.translate("Emmanuel Macron est le président de la France.",lang.ENGLISH,lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for translation visit https://guruyuga.com/languages/
Exemple #3
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** DEFINITIONS ************************************/
#
#  This example shows how to query Gurunudi to get definitions of a word or noun
#
#***************************** DEFINITIONS ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.define("Emmanuel Macron")
print(response)

#if language other than English, then specify
response = ai.define("Emmanuel Macron", lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for Definitions visit https://guruyuga.com/languages/
Exemple #4
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** CHAT ************************************/
#  
#  This example shows how to have a general conversation with Gurunudi AI
#  
#***************************** CHAT ************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

#default language is English
response=ai.chat('who wrote anna karenina?')
print(response)

#if language other than English, then specify
response=ai.chat('qui a écrit anna Karenina?',lang.FRENCH)
print(response)


#For the latest updated list of languages supported by Gurunudi for chat visit https://guruyuga.com/languages/
Exemple #5
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** DEFINITIONS ************************************/
#
#  This example shows how to debug responses from Gurunudi
#
#***************************** DEFINITIONS ************************************/

from gurunudi import AI, lang, config

#AI is the wrapper class to call Gurunudi AI API

ai = AI()

#To see the raw request and response data set the debug flag to true
config.DEBUG = True

#Now do some API call and the raw request and response data will be displayed in the console
response = ai.define("Emmanuel Macron")
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** CO-REFERENCE RESOLUTION ************************************/
#  
#  This example shows how to query Gurunudi to resolve coreferences in a text
#  
#***************************** COREFERENCE RESOLUTION ************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.coref("The women stopped taking pills because they were pregnant.")
print(response)

#if language other than English, then specify
response = ai.coref("Les femmes ont cessé de prendre des pilules parce qu'elles étaient enceintes.",lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for Coref Resolution visit https://guruyuga.com/languages/

Exemple #7
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** AUTOCORRECTION *******************************************/
#  
#  This example shows how to query Gurunudi to spell check and automatically correct a text
#  
#***************************** SPELL CHECK *********************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API

ai=AI()

response = ai.autocorrect("whois cming")
print(response)

response = ai.autocorrect("whchi is the captal of idnia")
print(response)

#By default the text is assumed to be in English language. If the text is in a different language, you can pass the corresponding language code. See example below for French text.
response = ai.autocorrect("Les femes ont cessé de prndre des piluls parce qu'elles étaient encintes.",lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for autocorrection visit https://guruyuga.com/languages/
Exemple #8
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** NATURAL LANGUAGE QUERY - NLQ ************************************/
#
#  This example shows how to query Gurunudi Knowledge Graph
#
#***************************** NATURAL LANGUAGE QUERY - NLQ ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API

ai = AI()

#default language is English
response = ai.graph_query({
    "theme": "India",
    "attribute": "capital",
    "value": "?"
})
print(response)

#if language other than English, then specify
response = ai.graph_query(
    {
        "theme": "Inde",
        "attribute": "capitale",
        "value": "?"
    }, lang.FRENCH)
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** KEYWORDS EXTRACTION ************************************/
#
#  This example shows how to query Gurunudi to extract keywords from a text
#
#***************************** KEYWORDS EXTRACTION ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.keywords(
    "India is a country in South Asia. It shares land borders with Pakistan to the west; China, Nepal, and Bhutan to the northeast; and Myanmar (Burma) and Bangladesh to the east."
)
print(response)

#if language other than English, then specify
response = ai.keywords(
    "L'India, ufficialmente Repubblica dell'India, è uno Stato federale dell'Asia meridionale, con capitale Nuova Delhi.",
    lang.ITALIAN)
print(response)

#For the latest updated list of languages supported by Gurunudi for keyword extraction visit https://guruyuga.com/languages/
Exemple #10
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** NATURAL LANGUAGE QUERY - NLQ ************************************/
#
#  This example shows how to query Gurunudi Knowledge Graph
#
#***************************** NATURAL LANGUAGE QUERY - NLQ ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API

ai = AI()

#default language is English
response = ai.query('capital of India')
print(response)

#if language other than English, then specify
response = ai.query("capitale de l'Inde", lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for knowledge graph query visit https://guruyuga.com/languages/
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** SENTIMENT ANALYSIS ************************************/
#
#  This example shows how to query Gurunudi to analyze the sentiment of a given piece of text
#
#***************************** SENTIMENT ANALYSIS ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.sentiment("I really did not like that movie")
print(response)

response = ai.sentiment("she is very beautiful")
print(response)

response = ai.sentiment("The ambience was good, but the food was bad")
print(response)

response = ai.sentiment("roses are red, violets are blue")
print(response)

#By default the text is assumed to be in English language. If the text is in a different language, you can pass the corresponding language code. See example below for German text.
response = ai.sentiment("Aller Anfang ist schwer", lang.GERMAN)
print(response)
Exemple #12
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** SUMMARY GENERATION *******************************************/
#  
#  This example shows how to query Gurunudi to summarize a given text
#  
#***************************** SUMMARY GENERATION *********************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai=AI()

response = ai.summary("<SOME_LARGE_TEXT_LIKE_AN_ARTICLE_OR_A_DOCUMENT>")
print(response)
 
#By default the text is assumed to be in English language. If the text is in a different language, you can pass the corresponding language code. See example below for French text.
response = ai.summary("Emmanuel Macron est le président de la France.",lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for summary generation visit https://guruyuga.com/languages/
Exemple #13
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** NATURAL LANGUAGE GENERATION - NLG ************************************/
#  
#  This example shows how to query Gurunudi to generate natural language text using given intent data.
#  
#***************************** NATURAL LANGUAGE GENERATION - NLG ************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.generate({"theme":"Delhi","attribute":"location","value":"India"})
print(response)

#For the latest updated list of languages supported by Gurunudi for natural language generation visit https://guruyuga.com/languages/

Exemple #14
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** FIX CASE ************************************/
#
#  This example shows how to query Gurunudi to fix cases and get true cased text
#
#***************************** TRUE CASE ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.fix_case("i went to jaPan")
print(response)

#if language other than English, then specify
response = ai.fix_case("emmanuel macron est le président de LA France",
                       lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for Case Fixing to generate True Case text visit https://guruyuga.com/languages/
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** TEXT CLASSIFICATION ************************************/
#
#  This example shows how to query Gurunudi to identify language of a text
#
#***************************** TEXT CLASSIFICATION ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.classify("John ate an apple.", "tense")
print(response)

response = ai.classify("Where are you going?.", "mood")
print(response)

response = ai.classify("Einstein discovered relativity.", "mood")
print(response)

response = ai.classify("You have won 1 million dollars", "email")
print(response)

response = ai.classify("India wins the ICC world cup", "news")
print(response)

response = ai.classify("that movie was really bad", "sentiment")
Exemple #16
0
from flask import Flask
from flask import render_template,jsonify,request
import requests
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
import re
from rasa_core.utils import EndpointConfig
from gurunudi import AI,lang

ai=AI()
core_endpoint_config = EndpointConfig(url="http://*****:*****@app.route('/')
def hello_world():
    return render_template('home.html')

@app.route('/chat',methods=["POST"])
def chat():
    try:
        match=None
        user_message = request.form["text"]
        print(user_message)
        # user_message=ai.autocorrect(user_message)
        print(user_message)
        responses = agent.handle_text(user_message)
Exemple #17
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** INTENT EXTRACTION ************************************/
#  
#  This example shows how to query Gurunudi to get intent of a text
#  
#***************************** INTENT EXTRACTION ************************************/

from gurunudi import AI,lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.intent("Larry Page was doing his Phd at Stanford University in 1996.")
print(response)

#if language other than English, then specify
response = ai.intent("Larry Page promovierte 1996 an der Stanford University.",lang.GERMAN)
print(response)

#For the latest updated list of languages supported by Gurunudi for Definitions visit https://guruyuga.com/languages/
Exemple #18
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** AUTOCOMPLETE *******************************************/
#
#  This example shows how to query Gurunudi to autocomplete a given text
#
#***************************** AUTOCOMPLETE *********************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.autocomplete("which is the fastest")
print(response)

#By default the text is assumed to be in English language. If the text is in a different language, you can pass the corresponding language code. See example below for French text.
response = ai.autocomplete("Emmanuel Macron est le président de la.",
                           lang.FRENCH)
print(response)

#For the latest updated list of languages supported by Gurunudi for autocomplete visit https://guruyuga.com/languages/
Exemple #19
0
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** TOPIC MODELING *******************************************/
#
#  This example shows how to query Gurunudi to suggest topics for a given text
#
#***************************** TOPIC MODELING *********************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.topics("Oil prices fall on expected output rise")
print(response)

#By default the text is assumed to be in English language. If the text is in a different language, you can pass the corresponding language code. See example below for Italian text.
response = ai.topics(
    "L'India, ufficialmente Repubblica dell'India, è uno Stato federale dell'Asia meridionale, con capitale Nuova Delhi.",
    lang.ITALIAN)
print(response)

#For the latest updated list of languages supported by Gurunudi for topic modeling visit https://guruyuga.com/languages/
#!/usr/bin/env python

from __future__ import division, print_function, absolute_import

#***************************** LANGUAGE DETECTION ************************************/
#
#  This example shows how to query Gurunudi to identify language of a text
#
#***************************** LANGUAGE IDENTIFICATION ************************************/

from gurunudi import AI, lang

#AI is the wrapper class to call Gurunudi AI API
ai = AI()

response = ai.language("lorem ipsum")
print(response)

response = ai.language_name("lorem ipsum")
print(response)

response = ai.language(
    "matter tells space how to curve and space tells matter how to move")
print(response)

response = ai.language("ನನ್ನ ಹೆಸರು ಗುರು")
print(response)

#For the latest updated list of languages supported by Gurunudi for language detection visit https://guruyuga.com/languages/