Skip to main content

A Natural Language processing parser for Zork-style games

Project description

Natan Logical Engine (NLE)

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 NLEParser.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.2.4.tar.gz (3.7 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.2.4-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nleparser-0.2.4.tar.gz
Algorithm Hash digest
SHA256 53ce7b09c7ff4600a7cca3ffc13b5ad8da43be48968e31c906a6db44cc647ce7
MD5 747c0fd281d000a5c89f25fd6357b41d
BLAKE2b-256 7a46a45504672bb3922ae9c73de26ee490df494f758b68ccf3752b812ae93594

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nleparser-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4b5de255cb7b9bd014e1c18eaba8e7cf2133bb0b51a07accb965601a1c325240
MD5 115d3278d03e5341cf3f4efcb8f123dd
BLAKE2b-256 8234a3403481fe4c3c1565957e385aa77f213bd4cb3e4005cbf23ddde9d93bbc

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