Skip to main content

A Natural language processing parser for Zork-style games

Project description

Natan Logical Engine (NLE)

Natan Logical Engine

Overview

Natan Logical Engine (NLE) is a simple natural language parser designed to interpret player commands in text-based games or interactive fiction. It processes input strings, removes stop words, resolves pronouns based on context, and extracts structured commands (verb and object) from user input.

Features

  • Stop Word Removal: Ignores common words that do not affect command meaning.
  • Pronoun Resolution: Substitutes pronouns with the last referenced object for contextual understanding.
  • Syntactic Analysis: Identifies verbs and objects from the input and returns structured commands.
  • Logging: Provides detailed debug and info logs for development and debugging.

Usage

Example usage in Python:

from parser import NLEParser

config = {
    "language": "en-us",
}
vocabulary = {
    "pronouns": {"he", "she", "it", "this", "that"},
    "verbs": {"take", "look", "use"},
    "objects": {"key", "door", "box"},
}
stop_words = {"the", "a", "an", "of", "in", "on", "at", "to"}

parser = NLEParser(config, vocabulary, stop_words)

parsed_command = parser.parse("take the key")
print(parsed_command)  # Output: {'verb': 'take', 'object': 'key'}

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

nleparser-0.1.1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nleparser-0.1.1-py3-none-any.whl (1.8 kB view details)

Uploaded Python 3

File details

Details for the file nleparser-0.1.1.tar.gz.

File metadata

  • Download URL: nleparser-0.1.1.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for nleparser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5f05f4961ced2e517873d110f5d73a439e60930c97107bbb968e5d0ad127472
MD5 3dd02069f1535f9a397e2b1ac8381d4e
BLAKE2b-256 9d4732fa56528a17a58f6fbf9db1d743a324f8d9718585ff5da812dbc712ebc2

See more details on using hashes here.

File details

Details for the file nleparser-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nleparser-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for nleparser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de22f3e3e0e334ea2df8b07eec6aa95f11e622db54045bc0c83be6942f7ba3c9
MD5 85c6201f5f860ffa3567ce4138efa751
BLAKE2b-256 ebf1c75bf7086d828f61c73d5d527e593e8b72903713aa66f98152deccb9353d

See more details on using hashes here.

Supported by

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