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 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nleparser-0.1.0.tar.gz.
File metadata
- Download URL: nleparser-0.1.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ffb86c420e4a5878d0e2c3124ddb101e4117bce766a1a8f30a47ef916f9f76a
|
|
| MD5 |
69e656dd5b74cbbc5257eebeba1a9e1c
|
|
| BLAKE2b-256 |
b85d6a1049f30ef7301faf4f3cfe9051336530a893b7511cd0c79408649a4d88
|
File details
Details for the file nleparser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nleparser-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1898f8bc33d0ecf4102ba27e93b50af5b7913a3e71e88b96b518b74d72effd47
|
|
| MD5 |
8dce69e53801a7c355fda2881f8cad1d
|
|
| BLAKE2b-256 |
10fff123a7848c56b161c0fc9683c6ac0e08d52c9e35d82363cb47b0565b23b7
|