Skip to main content

The Leolani Brain module for knowledge representation

Project description

cltl-knowledgerepresentation

A knowledge representation service (aka Leolani's Brain). This service expects structures data and outputs an RDF graph.

Description

This package contains the necessary functionality for creating an RDF episodic knowledge graph. It features:

  • Representation of experiences and their context
  • Storing of learned facts, their mentions/references, and the perspectives expressed
  • Querying of the graph as a way of accessing memories created during previous experiences
  • Typing of incoming information through querying of external knowledge sources like DBpedia and Wikidata
  • Location reasoning for guessing where a new experience is taking place, based on previous locations
  • Thoughts and drives that arise from new information added to the graph. For example
    • conflicts resulting from learned facts,
    • curiosity based on knowledge gaps,
    • generalization via shared characteristics across people or objects
  • Trust calculation of agents as sources of information. The trust value is based on:
    • the number of interaction with this agent,
    • the number of new content the agent has provided,
    • the number of conflicting information it has provided

Getting started

Prerequisites

This repository uses Python >= 3.7

Be sure to run in a virtual python environment (e.g. conda, venv, mkvirtualenv, etc.)

Installation

  1. In the root directory of this repo run

    pip install -e .
    python -c "import nltk; nltk.download('wordnet')"
    
  2. Additionally, you need to install GraphDB Free with a repository named sandbox. You will need to launch this before running the package.

Usage

For using this repository as a package for different project and on a different virtual environment, you may

  • install a published version from PyPI:

    pip install cltl.brain
    
  • or, for the latest snapshot, run:

    pip install git+git://github.com/leolani/cltl-knowledgerepresentation.git@main
    

Then you can import it in a python script as:

import cltl.brain

You can also modify the logger level as such:

import logging

from cltl.brain import logger as brain_logger

brain_logger.setLevel(logging.ERROR)

Examples

Please take a look at the example scripts provided to get an idea on how to run and use this package. Each example has a comment at the top of the script describing the behaviour of the script.

For these example scripts, you need

  1. A repository on GraphDB Free called sandbox. To run any example script you first have to launch GraphDB, and then you can run the example script.

  2. To change your current directory to ./examples/

  3. Run some examples (e.g. python carl.py)

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cltl.brain-1.0.dev2.tar.gz (264.3 kB view details)

Uploaded Source

File details

Details for the file cltl.brain-1.0.dev2.tar.gz.

File metadata

  • Download URL: cltl.brain-1.0.dev2.tar.gz
  • Upload date:
  • Size: 264.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for cltl.brain-1.0.dev2.tar.gz
Algorithm Hash digest
SHA256 8618dd039d5c55f606ae48a8dc5df50f0f02b24aa34adf0127e71a4dfa188919
MD5 a47a3e5acff7cc75e26ed9dbbe1669b1
BLAKE2b-256 16722aae2e723fb86cde9e00bf9480ec3cd5e3e7b704cd6279e06dd3348f5542

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page