Skip to main content

Ontology Builder (owl-builder)

Key Term Extraction

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

[
   "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:

os.environ['USE_OPENAI'] = "True"
os.environ['OPENAI_KEY'] = "<openai-key>"
os.environ['OPENAI_ORG'] = "<openai-org>"

TTL Generation

from owl_builder import build_ttl

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

The result is

###  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:

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

###  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" .

Metadata

Release files for owl-builder 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for owl-builder 0.2.3
File Size Uploaded
owl_builder-0.2.3.tar.gz 26.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for owl-builder 0.2.3
File Interpreter ABI Platform
owl_builder-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 73.2 kB

Release files / owl_builder-0.2.3.tar.gz

Download URL owl_builder-0.2.3.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e6f35e7eb5c20debda195ee4753241588150912fd751e6de36d816841cca9277
BLAKE2b-256 checksum
How to use checksums
dce81c2f535a3786abaa577726dd9762964edb9c2fd5eeec4890fce6814aa9ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.5 Windows/10

Release files / owl_builder-0.2.3-py3-none-any.whl

Download URL owl_builder-0.2.3-py3-none-any.whl
Size 46.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc0b08de8138ef437c88967af51ab5152d584dc4a6114c79d26cd6bdca6db0e2
BLAKE2b-256 checksum
How to use checksums
2bb1c9b476f46677f68c69261328a23683734afe6b39284c61e970120284845a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.5 Windows/10

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page