owl-builder


Nameowl-builder JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/craigtrim/owl-builder
SummaryTools for Automating the Construction of an Ontology (OWL)
upload_time2023-07-26 18:11:41
maintainerCraig Trim
docs_urlNone
authorCraig Trim
requires_python>=3.8.5,<4.0.0
licenseNone
keywords nlp nlu ai ontology automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ontology Builder (owl-builder)

##

## Key Term Extraction
```python
from owl_builder import keyterms

input_text = """
A local area network (LAN) is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, university campus or office building.

By contrast, a wide area network (WAN) not only covers a larger geographic distance, but also generally involves leased telecommunication circuits.

Ethernet and Wi-Fi are the two most common technologies in use for local area networks.

Historical network technologies include ARCNET, Token Ring, and AppleTalk.
"""

results = keyterms(
    input_text=input_text,
    use_openai=False,
    use_terms=True,
    use_keyterms=True,
    use_ngrams=False,
    use_nounchunks=False)
```

The results are
```json
[
   "leased telecommunication circuit",
   "historical network technology",
   "large geographic distance",
   "interconnects computer",
   "local area network",
   "university campus",
   "common technology",
   "wide area network",
   "computer network",
   "office building",
   "include arcnet",
   "limited area",
   "token ring"
]
```

If `use_openai` is set to `True`, then the following environment variables must be set:
```python
os.environ['USE_OPENAI'] = "True"
os.environ['OPENAI_KEY'] = "<openai-key>"
os.environ['OPENAI_ORG'] = "<openai-org>"
```

## TTL Generation
```python
from owl_builder import build_ttl

results = build_ttl("He has aims to make Detroit a leader in green energy.")
```

The result is
```ttl
###  http://graffl.ai/pathology#green_energy
        :green_energy rdf:type owl:Class ;
        rdfs:label "Green Energy" ;
        rdfs:subClassOf :energy .
###  http://graffl.ai/pathology#energy
        :energy rdf:type owl:Class ;
        rdfs:label "Energy" .
```

You can also supply your own taxonomy like this:
```python
import pandas as pd

results = build_ttl(pd.DataFrame([
    {"Parent": "Alpha", "Child": "Alpha Beta"},
    {"Parent": "Alpha Beta", "Child": "Alpha Beta Gamma"},
    {"Parent": "Gamma", "Child": "Gamma Delta"},
]))
```

The result is
```ttl
###  http://graffl.ai/pathology#alpha_beta
        :alpha_beta rdf:type owl:Class ;
        rdfs:label "Alpha Beta" ;
        rdfs:subClassOf :alpha .
###  http://graffl.ai/pathology#alpha
            :alpha rdf:type owl:Class ;
            rdfs:label "Alpha" .
###  http://graffl.ai/pathology#alpha_beta_gamma
            :alpha_beta_gamma rdf:type owl:Class ;
            rdfs:label "Alpha Beta Gamma" ;
            rdfs:subClassOf :alpha_beta .
###  http://graffl.ai/pathology#alpha_beta
            :alpha_beta rdf:type owl:Class ;
            rdfs:label "Alpha Beta" .
###  http://graffl.ai/pathology#gamma_delta
            :gamma_delta rdf:type owl:Class ;
            rdfs:label "Gamma Delta" ;
            rdfs:subClassOf :gamma .
###  http://graffl.ai/pathology#gamma
            :gamma rdf:type owl:Class ;
            rdfs:label "Gamma" .
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/craigtrim/owl-builder",
    "name": "owl-builder",
    "maintainer": "Craig Trim",
    "docs_url": null,
    "requires_python": ">=3.8.5,<4.0.0",
    "maintainer_email": "craigtrim@gmail.com",
    "keywords": "nlp,nlu,ai,ontology,automation",
    "author": "Craig Trim",
    "author_email": "craigtrim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/e8/1c2f535a3786abaa577726dd9762964edb9c2fd5eeec4890fce6814aa9ad/owl_builder-0.2.3.tar.gz",
    "platform": null,
    "description": "# Ontology Builder (owl-builder)\n\n##\n\n## Key Term Extraction\n```python\nfrom owl_builder import keyterms\n\ninput_text = \"\"\"\nA local area network (LAN) is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, university campus or office building.\n\nBy contrast, a wide area network (WAN) not only covers a larger geographic distance, but also generally involves leased telecommunication circuits.\n\nEthernet and Wi-Fi are the two most common technologies in use for local area networks.\n\nHistorical network technologies include ARCNET, Token Ring, and AppleTalk.\n\"\"\"\n\nresults = keyterms(\n    input_text=input_text,\n    use_openai=False,\n    use_terms=True,\n    use_keyterms=True,\n    use_ngrams=False,\n    use_nounchunks=False)\n```\n\nThe results are\n```json\n[\n   \"leased telecommunication circuit\",\n   \"historical network technology\",\n   \"large geographic distance\",\n   \"interconnects computer\",\n   \"local area network\",\n   \"university campus\",\n   \"common technology\",\n   \"wide area network\",\n   \"computer network\",\n   \"office building\",\n   \"include arcnet\",\n   \"limited area\",\n   \"token ring\"\n]\n```\n\nIf `use_openai` is set to `True`, then the following environment variables must be set:\n```python\nos.environ['USE_OPENAI'] = \"True\"\nos.environ['OPENAI_KEY'] = \"<openai-key>\"\nos.environ['OPENAI_ORG'] = \"<openai-org>\"\n```\n\n## TTL Generation\n```python\nfrom owl_builder import build_ttl\n\nresults = build_ttl(\"He has aims to make Detroit a leader in green energy.\")\n```\n\nThe result is\n```ttl\n###  http://graffl.ai/pathology#green_energy\n        :green_energy rdf:type owl:Class ;\n        rdfs:label \"Green Energy\" ;\n        rdfs:subClassOf :energy .\n###  http://graffl.ai/pathology#energy\n        :energy rdf:type owl:Class ;\n        rdfs:label \"Energy\" .\n```\n\nYou can also supply your own taxonomy like this:\n```python\nimport pandas as pd\n\nresults = build_ttl(pd.DataFrame([\n    {\"Parent\": \"Alpha\", \"Child\": \"Alpha Beta\"},\n    {\"Parent\": \"Alpha Beta\", \"Child\": \"Alpha Beta Gamma\"},\n    {\"Parent\": \"Gamma\", \"Child\": \"Gamma Delta\"},\n]))\n```\n\nThe result is\n```ttl\n###  http://graffl.ai/pathology#alpha_beta\n        :alpha_beta rdf:type owl:Class ;\n        rdfs:label \"Alpha Beta\" ;\n        rdfs:subClassOf :alpha .\n###  http://graffl.ai/pathology#alpha\n            :alpha rdf:type owl:Class ;\n            rdfs:label \"Alpha\" .\n###  http://graffl.ai/pathology#alpha_beta_gamma\n            :alpha_beta_gamma rdf:type owl:Class ;\n            rdfs:label \"Alpha Beta Gamma\" ;\n            rdfs:subClassOf :alpha_beta .\n###  http://graffl.ai/pathology#alpha_beta\n            :alpha_beta rdf:type owl:Class ;\n            rdfs:label \"Alpha Beta\" .\n###  http://graffl.ai/pathology#gamma_delta\n            :gamma_delta rdf:type owl:Class ;\n            rdfs:label \"Gamma Delta\" ;\n            rdfs:subClassOf :gamma .\n###  http://graffl.ai/pathology#gamma\n            :gamma rdf:type owl:Class ;\n            rdfs:label \"Gamma\" .\n```\n",
    "bugtrack_url": null,
    "license": "None",
    "summary": "Tools for Automating the Construction of an Ontology (OWL)",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/craigtrim/owl-builder",
        "Repository": "https://github.com/craigtrim/owl-builder"
    },
    "split_keywords": [
        "nlp",
        "nlu",
        "ai",
        "ontology",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bb1c9b476f46677f68c69261328a23683734afe6b39284c61e970120284845a",
                "md5": "f17c24b0b6eacedeed2facc225c6fb9d",
                "sha256": "bc0b08de8138ef437c88967af51ab5152d584dc4a6114c79d26cd6bdca6db0e2"
            },
            "downloads": -1,
            "filename": "owl_builder-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f17c24b0b6eacedeed2facc225c6fb9d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 46610,
            "upload_time": "2023-07-26T18:11:39",
            "upload_time_iso_8601": "2023-07-26T18:11:39.939099Z",
            "url": "https://files.pythonhosted.org/packages/2b/b1/c9b476f46677f68c69261328a23683734afe6b39284c61e970120284845a/owl_builder-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dce81c2f535a3786abaa577726dd9762964edb9c2fd5eeec4890fce6814aa9ad",
                "md5": "72e11b544ae8cfb46d62bcffb9e649ca",
                "sha256": "e6f35e7eb5c20debda195ee4753241588150912fd751e6de36d816841cca9277"
            },
            "downloads": -1,
            "filename": "owl_builder-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "72e11b544ae8cfb46d62bcffb9e649ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.5,<4.0.0",
            "size": 26543,
            "upload_time": "2023-07-26T18:11:41",
            "upload_time_iso_8601": "2023-07-26T18:11:41.492937Z",
            "url": "https://files.pythonhosted.org/packages/dc/e8/1c2f535a3786abaa577726dd9762964edb9c2fd5eeec4890fce6814aa9ad/owl_builder-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-26 18:11:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "craigtrim",
    "github_project": "owl-builder",
    "github_not_found": true,
    "lcname": "owl-builder"
}
        
Elapsed time: 0.74151s