# Intentify
A python library for training intent classification models.
## Setting Up A Basic Model
```python
from intentify import Intentify
file_path = 'intents.json'
name = 'test_model'
Model = Intentify(file_path, model_name=name)
Model.train_model()
Model.save_model()
done = False
while not done:
message = input("You: ")
if message == "STOP":
done = True
else:
response = Model.request(message)
print(response)
```
## Binding Functions To Requests
```python
from intentify import Intentify
def function_for_greetings():
print("Greetings Intent Trigger!")
# Some action you want to take
def function_for_stocks():
print("Stocks Intent Trigger!")
# Some action you want to take
mappings = {'greeting' : function_for_greetings, 'stocks' : function_for_stocks}
file_path = 'intents.json'
name = 'test_model'
Model = Intentify(file_path, intent_methods=mappings ,model_name=name)
Model.train_model()
Model.save_model()
done = False
while not done:
message = input("Enter a message: ")
if message == "STOP":
done = True
else:
Model.request(message)
```
Once you have saved the model you can simply call "Model.load_model()" instead of ".train_model()" and ".save_model()"
## Sample intents.json File
```json
{"intents": [
{"tag": "greeting",
"patterns": ["Hi", "How are you", "Is anyone there?", "Hello", "Good day", "Whats up", "Hey", "greetings"],
"responses": ["Hello!", "Good to see you again!", "Hi there, how can I help?"],
"context_set": ""
},
{"tag": "goodbye",
"patterns": ["cya", "See you later", "Goodbye", "I am Leaving", "Have a Good day", "bye", "cao", "see ya"],
"responses": ["Sad to see you go :(", "Talk to you later", "Goodbye!"],
"context_set": ""
},
{"tag": "stocks",
"patterns": ["what stocks do I own?", "how are my shares?", "what companies am I investing in?", "what am I doing in the markets?"],
"responses": ["You own the following shares: ABBV, AAPL, FB, NVDA and an ETF of the S&P 500 Index!"],
"context_set": ""
}
]
}
```
Raw data
{
"_id": null,
"home_page": "",
"name": "intentify",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,intent,intents,ai,intent classification",
"author": "Ice (Rishan Pancham)",
"author_email": "<rishanpan@hotmail.com>",
"download_url": "https://files.pythonhosted.org/packages/76/98/4e2f0361b416c3faa2de447fb42944939703e05a2449f07b6601dd06eb1c/intentify-0.0.3.tar.gz",
"platform": null,
"description": "# Intentify\r\n\r\nA python library for training intent classification models.\r\n\r\n## Setting Up A Basic Model\r\n\r\n```python\r\n\r\nfrom intentify import Intentify\r\n\r\nfile_path = 'intents.json'\r\nname = 'test_model'\r\n\r\nModel = Intentify(file_path, model_name=name)\r\nModel.train_model()\r\nModel.save_model()\r\n\r\ndone = False\r\n\r\nwhile not done:\r\n message = input(\"You: \")\r\n if message == \"STOP\":\r\n done = True\r\n else:\r\n response = Model.request(message)\r\n print(response)\r\n```\r\n\r\n## Binding Functions To Requests\r\n\r\n```python\r\nfrom intentify import Intentify\r\n\r\ndef function_for_greetings():\r\n print(\"Greetings Intent Trigger!\")\r\n # Some action you want to take\r\n\r\ndef function_for_stocks():\r\n print(\"Stocks Intent Trigger!\")\r\n # Some action you want to take\r\n\r\nmappings = {'greeting' : function_for_greetings, 'stocks' : function_for_stocks}\r\nfile_path = 'intents.json'\r\nname = 'test_model'\r\n\r\nModel = Intentify(file_path, intent_methods=mappings ,model_name=name)\r\nModel.train_model()\r\nModel.save_model()\r\n\r\ndone = False\r\n\r\nwhile not done:\r\n message = input(\"Enter a message: \")\r\n if message == \"STOP\":\r\n done = True\r\n else:\r\n Model.request(message)\r\n\r\n```\r\n\r\nOnce you have saved the model you can simply call \"Model.load_model()\" instead of \".train_model()\" and \".save_model()\"\r\n\r\n\r\n## Sample intents.json File\r\n```json\r\n{\"intents\": [\r\n {\"tag\": \"greeting\",\r\n \"patterns\": [\"Hi\", \"How are you\", \"Is anyone there?\", \"Hello\", \"Good day\", \"Whats up\", \"Hey\", \"greetings\"],\r\n \"responses\": [\"Hello!\", \"Good to see you again!\", \"Hi there, how can I help?\"],\r\n \"context_set\": \"\"\r\n },\r\n {\"tag\": \"goodbye\",\r\n \"patterns\": [\"cya\", \"See you later\", \"Goodbye\", \"I am Leaving\", \"Have a Good day\", \"bye\", \"cao\", \"see ya\"],\r\n \"responses\": [\"Sad to see you go :(\", \"Talk to you later\", \"Goodbye!\"],\r\n \"context_set\": \"\"\r\n },\r\n {\"tag\": \"stocks\",\r\n \"patterns\": [\"what stocks do I own?\", \"how are my shares?\", \"what companies am I investing in?\", \"what am I doing in the markets?\"],\r\n \"responses\": [\"You own the following shares: ABBV, AAPL, FB, NVDA and an ETF of the S&P 500 Index!\"],\r\n \"context_set\": \"\"\r\n }\r\n]\r\n}\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "An intent classification library for AI Models.",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"python",
"intent",
"intents",
"ai",
"intent classification"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "554e600a1db161634b4d6166f45dc03c307dc23ac1d1a8f8715368501aaade34",
"md5": "289453eff70960d4731b286a657a8957",
"sha256": "e63866123ea09d99ed527bffd347a4f25d767379c0714dc186248515040743a4"
},
"downloads": -1,
"filename": "intentify-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "289453eff70960d4731b286a657a8957",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4181,
"upload_time": "2023-07-09T18:42:02",
"upload_time_iso_8601": "2023-07-09T18:42:02.370234Z",
"url": "https://files.pythonhosted.org/packages/55/4e/600a1db161634b4d6166f45dc03c307dc23ac1d1a8f8715368501aaade34/intentify-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "76984e2f0361b416c3faa2de447fb42944939703e05a2449f07b6601dd06eb1c",
"md5": "8ee526c2bd0196b3ec1dfa0fc997e4b3",
"sha256": "88b8f0757e10bc228f4a8fc3cdf2ff31d80a882b28186fc23e5a526a833d7ab0"
},
"downloads": -1,
"filename": "intentify-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "8ee526c2bd0196b3ec1dfa0fc997e4b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4122,
"upload_time": "2023-07-09T18:42:03",
"upload_time_iso_8601": "2023-07-09T18:42:03.918783Z",
"url": "https://files.pythonhosted.org/packages/76/98/4e2f0361b416c3faa2de447fb42944939703e05a2449f07b6601dd06eb1c/intentify-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-09 18:42:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "intentify"
}