{"id":30651271,"url":"https://github.com/samuobe/pyntent","last_synced_at":"2025-08-31T06:13:41.948Z","repository":{"id":306325262,"uuid":"1024514667","full_name":"Samuobe/Pyntent","owner":"Samuobe","description":"Pyntent is a lightweight Python library for intent recognition using plain text files. You define possible user phrases for each intent in separate files, and an index file maps intent codes to these files. The library matches a given phrase to the best intent based on keyword overlap.","archived":false,"fork":false,"pushed_at":"2025-07-24T20:59:08.000Z","size":5,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-12T13:54:46.391Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Samuobe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-07-22T20:26:48.000Z","updated_at":"2025-07-24T20:59:12.000Z","dependencies_parsed_at":"2025-07-25T01:53:28.669Z","dependency_job_id":"86253393-76da-4892-8a40-c25ed38042d5","html_url":"https://github.com/Samuobe/Pyntent","commit_stats":null,"previous_names":["ilnonop/pyntent","samuobe/pyntent"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Samuobe/Pyntent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samuobe%2FPyntent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samuobe%2FPyntent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samuobe%2FPyntent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samuobe%2FPyntent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Samuobe","download_url":"https://codeload.github.com/Samuobe/Pyntent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samuobe%2FPyntent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272944776,"owners_count":25019629,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-31T06:13:00.913Z","updated_at":"2025-08-31T06:13:41.936Z","avatar_url":"https://github.com/Samuobe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pyntent 🚀\n\nPyntent is a lightweight, easy-to-use Python library for intent recognition using plain text files.  \nYou define possible user phrases for each intent in separate files, and an index file maps intent codes to these files.  \nThe library matches a given phrase to the best intent based on keyword overlap.\n\n---\n\n## ✨ Features\n\n- **No dependencies**: Pure Python, no external libraries required.\n- **Simple setup**: Just text files for your intents.\n- **Fast matching**: Finds the best intent using keyword overlap.\n- **Easy to extend**: Add new intents by creating new files.\n\n---\n\n## ⚙️ How It Works\n\n1. **Define intents**: Each intent is described by a text file containing example phrases.\n2. **Index mapping**: The `intent/INDEX.txt` file maps intent codes to their corresponding files.\n3. **Matching**: When you call `get_intent(phrase)`, the library compares the input phrase to all example phrases and returns the intent code with the highest match percentage.\n\n---\n\n## 📁 File Structure Example\n\n```\npyntent.py\nintent/\n├── INDEX.txt\n├── weather.txt\n└── greetings.txt\n```\n\n### Example: `intent/INDEX.txt`\n\n```\n0|greetings\n1|weather\n```\n- `0` is the code for greetings, using `greetings.txt`\n- `1` is the code for weather, using `weather.txt`\n\n### Example: `intent/greetings.txt`\n\n```\nHello\nGood morning\nHello, how are you?\nHi\n```\n\n### Example: `intent/weather.txt`\n\n```\nWhat's the weather like today?\nHow many degrees is it?\nWhat's the weather?\n```\n\n---\n\n## 🚦 How to Use\n\n1. Place `pyntent.py` and the `intent/` folder (with your `.txt` files) in the same directory.\n2. Edit `intent/INDEX.txt` to map intent codes to file names (without `.txt`).\n3. Add example phrases (one per line) in each intent file.\n\n### Example Usage\n\n```python\nfrom pyntent import get_intent\n\nintent_id, confidence = get_intent(\"What's the weather like today?\")\nprint(f\"Intent ID: {intent_id}, Confidence: {confidence:.2f}\")\n```\n\nThis will return the intent code (e.g., `1` for weather) and a confidence score.\n\n---\n\n## 💡 Tips for Improving Accuracy\n\n- **Use clear, representative phrases** for each intent.\n- **Avoid overlapping phrases** between different intents.\n- **Normalize your phrases**: keep them lowercase and remove punctuation.\n- **Add more examples**: The more varied your example phrases, the better the recognition.\n- **Group synonyms**: Include common variations and synonyms for user queries.\n- **Regularly review**: Update your intent files as you discover new user inputs.\n\n---\n\n## 🛠️ Application Scenarios\n\n- **Chatbots**: Quickly map user messages to intents for conversational AI.\n- **Voice assistants**: Recognize spoken commands and map them to actions.\n- **FAQ bots**: Route user questions to the correct answers.\n- **Simple command interpreters**: Build CLI tools that understand natural language commands.\n- **Prototyping**: Rapidly test intent recognition logic without complex ML models.\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuobe%2Fpyntent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuobe%2Fpyntent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuobe%2Fpyntent/lists"}