cmdify


Namecmdify JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryA lightweight command-line language processing utility.
upload_time2023-04-29 18:40:52
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT License
keywords nlp lightweight command line language processing natural language processing twilight imperium ti4
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cmdify

A lightweight command-line language processing tool, originally developed for Twilight Imperium 4.

## Installation

```commandline
pip install cmdify
```

## Usage

```python
from cmdify.core import QueryProcessor
from cmdify.preprocessors import SimplePreprocessor
from cmdify.identifiers import GraphPruningIdentifier, CachedIdentifier
from cmdify.interpreters import SimpleInterpreter
from cmdify.result import *

vocabulary = {
    'noun': {
        'dog': ['wolf'],
        'fox': [],
    },
    'qualifier': {
        'quick': ['fast', 'brisk'],
        'brown': [],
        'lazy': [],
    },
    'verb': {
        'play': [],
        'jump': ['leap', 'hop'],
    },
    'preposition': {
        'over': ['above'],
        'under': ['below'],
        'to': ['towards']
    },
    'conjunction': {
        'and': []
    },
    'skip_word': {
        'a': ['an'],
        'the': []
    },
}

processor = QueryProcessor.factory()\
    .set_vocabulary(**vocabulary)\
    .set_preprocessor(SimplePreprocessor)\
    .set_identifier(GraphPruningIdentifier, threshold=6)\
    .add_identifier_wrapper(CachedIdentifier, buffer_size=60)\
    .set_interpreter(SimpleInterpreter)\
    .build()

result = processor.process('leap over the lazy dog')

if isinstance(result, Success):
    actions: list[Action] = result.result
    # Some sort of processing . . .
elif isinstance(result, Failure):
    errors: list[Error] = result.errors
    # Some sort of processing . . .
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cmdify",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "nlp,lightweight,command line,language processing,natural language processing,twilight imperium,ti4",
    "author": "",
    "author_email": "Daniel Roland <its.daniel.roland@gmail.com>, \"Jonathan M. Lobmeyer\" <jmlobmeyer@gmail.com>, Nicole Livingston <nliving73@gmail.com>, William Blazer <williamblazer2@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8e/a6/ed2490d6697987891861fe651f06ae9bc591bc2bf49d14e0be724f8d619c/cmdify-0.1.3.tar.gz",
    "platform": null,
    "description": "# cmdify\r\n\r\nA lightweight command-line language processing tool, originally developed for Twilight Imperium 4.\r\n\r\n## Installation\r\n\r\n```commandline\r\npip install cmdify\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom cmdify.core import QueryProcessor\r\nfrom cmdify.preprocessors import SimplePreprocessor\r\nfrom cmdify.identifiers import GraphPruningIdentifier, CachedIdentifier\r\nfrom cmdify.interpreters import SimpleInterpreter\r\nfrom cmdify.result import *\r\n\r\nvocabulary = {\r\n    'noun': {\r\n        'dog': ['wolf'],\r\n        'fox': [],\r\n    },\r\n    'qualifier': {\r\n        'quick': ['fast', 'brisk'],\r\n        'brown': [],\r\n        'lazy': [],\r\n    },\r\n    'verb': {\r\n        'play': [],\r\n        'jump': ['leap', 'hop'],\r\n    },\r\n    'preposition': {\r\n        'over': ['above'],\r\n        'under': ['below'],\r\n        'to': ['towards']\r\n    },\r\n    'conjunction': {\r\n        'and': []\r\n    },\r\n    'skip_word': {\r\n        'a': ['an'],\r\n        'the': []\r\n    },\r\n}\r\n\r\nprocessor = QueryProcessor.factory()\\\r\n    .set_vocabulary(**vocabulary)\\\r\n    .set_preprocessor(SimplePreprocessor)\\\r\n    .set_identifier(GraphPruningIdentifier, threshold=6)\\\r\n    .add_identifier_wrapper(CachedIdentifier, buffer_size=60)\\\r\n    .set_interpreter(SimpleInterpreter)\\\r\n    .build()\r\n\r\nresult = processor.process('leap over the lazy dog')\r\n\r\nif isinstance(result, Success):\r\n    actions: list[Action] = result.result\r\n    # Some sort of processing . . .\r\nelif isinstance(result, Failure):\r\n    errors: list[Error] = result.errors\r\n    # Some sort of processing . . .\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A lightweight command-line language processing utility.",
    "version": "0.1.3",
    "project_urls": {
        "repository": "https://github.com/dqnnyr/cmdify.git"
    },
    "split_keywords": [
        "nlp",
        "lightweight",
        "command line",
        "language processing",
        "natural language processing",
        "twilight imperium",
        "ti4"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7edc0f9e991c76601b7f4fb0d12db7c248b971e69178ae2edbf9c7cfa7d54580",
                "md5": "33033137e8b73b30320f5f7c3ad16506",
                "sha256": "dd008a5fd33457c789c72a48b39a62773ff1379bea717621eebf6270d4019387"
            },
            "downloads": -1,
            "filename": "cmdify-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "33033137e8b73b30320f5f7c3ad16506",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8952,
            "upload_time": "2023-04-29T18:40:50",
            "upload_time_iso_8601": "2023-04-29T18:40:50.298067Z",
            "url": "https://files.pythonhosted.org/packages/7e/dc/0f9e991c76601b7f4fb0d12db7c248b971e69178ae2edbf9c7cfa7d54580/cmdify-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ea6ed2490d6697987891861fe651f06ae9bc591bc2bf49d14e0be724f8d619c",
                "md5": "aa295a2a51b019998d0fce8fb12fcffc",
                "sha256": "27181ee3fc0eeaffe833443b3d309a007d438e6411e177c81bc747ff4f02da4b"
            },
            "downloads": -1,
            "filename": "cmdify-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "aa295a2a51b019998d0fce8fb12fcffc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8490,
            "upload_time": "2023-04-29T18:40:52",
            "upload_time_iso_8601": "2023-04-29T18:40:52.322074Z",
            "url": "https://files.pythonhosted.org/packages/8e/a6/ed2490d6697987891861fe651f06ae9bc591bc2bf49d14e0be724f8d619c/cmdify-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-29 18:40:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dqnnyr",
    "github_project": "cmdify.git",
    "lcname": "cmdify"
}
        
Elapsed time: 1.05469s