{"id":20445146,"url":"https://github.com/hetpandya/intent-classifier","last_synced_at":"2025-04-13T00:41:20.553Z","repository":{"id":144134590,"uuid":"305362592","full_name":"hetpandya/intent-classifier","owner":"hetpandya","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-25T07:21:50.000Z","size":19187,"stargazers_count":4,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T18:43:44.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hetpandya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-19T11:33:40.000Z","updated_at":"2024-05-20T13:08:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"f72af24b-9ec1-42cb-803f-147f4cfe32c4","html_url":"https://github.com/hetpandya/intent-classifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hetpandya%2Fintent-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hetpandya%2Fintent-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hetpandya%2Fintent-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hetpandya%2Fintent-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hetpandya","download_url":"https://codeload.github.com/hetpandya/intent-classifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650414,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:11:08.463Z","updated_at":"2025-04-13T00:41:20.548Z","avatar_url":"https://github.com/hetpandya.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intent Classifier\n\nCode for Medium blog post [Creating Your own Intent Classifier](https://medium.com/analytics-vidhya/creating-your-own-intent-classifier-b86e000a4926).\n\n### Requirements\n`pip install wget tensorflow==1.5 pandas numpy keras`\n\n### Training\nFor training, check: [intent_classification.ipynb](https://github.com/thehetpandya/intent-classifier/blob/main/intent_classification.ipynb)\n\n### Inference\n```\nimport pickle\nfrom tensorflow.python.keras.models import load_model\nfrom tensorflow.python.keras.preprocessing.sequence import pad_sequences\nimport numpy as np\n\nclass IntentClassifier:\n    def __init__(self,classes,model,tokenizer,label_encoder):\n        self.classes = classes\n        self.classifier = model\n        self.tokenizer = tokenizer\n        self.label_encoder = label_encoder\n\n    def get_intent(self,text):\n        self.text = [text]\n        self.test_keras = self.tokenizer.texts_to_sequences(self.text)\n        self.test_keras_sequence = pad_sequences(self.test_keras, maxlen=16, padding='post')\n        self.pred = self.classifier.predict(self.test_keras_sequence)\n        return self.label_encoder.inverse_transform(np.argmax(self.pred,1))[0]\n \nmodel = load_model('models/intents.h5')\n\nwith open('utils/classes.pkl','rb') as file:\n  classes = pickle.load(file)\n\nwith open('utils/tokenizer.pkl','rb') as file:\n  tokenizer = pickle.load(file)\n\nwith open('utils/label_encoder.pkl','rb') as file:\n  label_encoder = pickle.load(file)\n  \nnlu = IntentClassifier(classes,model,tokenizer,label_encoder)\nprint(nlu.get_intent(\"is it cold in India right now\"))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhetpandya%2Fintent-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhetpandya%2Fintent-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhetpandya%2Fintent-classifier/lists"}