[Solved] python: (calling all experts out there to help) how do i write a chatbot which can commands and execute a python function?


Well one suggestion is to use NLP Linguistic Features

For ease, i will be using spacy

 import spacy
 nlp = spacy.load('en_core_web_md')
 doc = nlp('Get me all sales numbers for August in the Delhi')
 for token in doc:
    print(token.text,token.dep_,token.pos_)

Output

| 'Word'  | 'DEPENDENY' | 'POS'  |
----------------------------------
|'Get'    |   'ROOT'    | 'AUX'  |
|'me',    |  'dative'   | 'PRON' |
|'all'    |   'det'     | 'DET'  |
|'sales'  | 'compound'  | 'NOUN' |
|'numbers'|   'dobj'    | 'NOUN' |
|'for'    |   'prep'    | 'ADP'  |
|'August' |   'pobj'    | 'PROPN'|
|'in'     |   'prep'    | 'ADP'  |
|'the'    |   'det'     | 'DET'  |
|'Delhi'  |   'pobj'    | 'PROPN'|

Here you can use these attributes extracted such as pos tagging and dependency to get your desired value e.g

df[DEPENDENY.compound].mean()

You can devise more NLP techniques such as entity recognition and based on that you can move further to create queries. This may take an in-depth thinking for logic formulation but u need to explore more and write some rules.

solved python: (calling all experts out there to help) how do i write a chatbot which can commands and execute a python function?