Skip to main content

EnglishAI

EnglishAI is a symbolic English parser and reasoning engine written in Python.

Instead of using statistical prediction, EnglishAI tries to represent language using explicit symbolic structures and grammar rules.

The project is experimental and under active development.

Code Example for Demonstration

from englishai import code, decode, answer
s = "my mother's mother's daughter was mary"
eq = code(s)
print(f"EQUATION: {eq}\nSENTENCE: {s}\nSENTENCE AFTER DECODING EQUATION IN PRESENT TENSE: {decode(eq)}")
print()
# basic question answerer based on context
question_context = [
    ("who are you", "i am your father. you are a boy."),
    ("is mary alive", "your father is my father. your mother is my mother. you are mary. i killed my sister"),
    ("am i alive", "am alive i"), # invalid sentence
    ("am i alive", "i killed john"),
    ("who is my mother", "my mother's mother's daughter is mary"),
    ("is bob alive", "i am your father. my son is bob. i killed my son."),
    ("who is john", "john is my mother."), # john is a boy name and boys can't be mother
    ("is john alive", "i kills john's father"), # wrong grammar
    ("is john alive", "she kills john's father"), # corrected grammar
]
for question, context in question_context:
  try:
    out = answer(question, context)
  except:
    out = None
  print(f"CONTEXT: {context}")
  print(f"QUESTION: {question} ?")
  if out is not None:
    print(f"ANSWER: {'{'+', '.join(out)+'}' if isinstance(out, list) else out}")
  else:
    print("ANSWER: the reasoning proves that the context is contradictory / grammar error / incorrect format or spelling error / unsupported sentence or out of vocabulary")
  print()

Output of the Code

EQUATION: equal(daughter(mother(mother(i))),mary)
SENTENCE: my mother's mother's daughter was mary
SENTENCE AFTER DECODING EQUATION IN PRESENT TENSE: my mother's mother's daughter is mary

CONTEXT: i am your father. you are a boy.
QUESTION: who are you ?
ANSWER: {i, your son}

CONTEXT: your father is my father. your mother is my mother. you are mary. i killed my sister
QUESTION: is mary alive ?
ANSWER: no

CONTEXT: am alive i
QUESTION: am i alive ?
ANSWER: the reasoning proves that the context is contradictory / grammar error / incorrect format or spelling error / unsupported sentence or out of vocabulary

CONTEXT: i killed john
QUESTION: am i alive ?
ANSWER: yes

CONTEXT: my mother's mother's daughter is mary
QUESTION: who is my mother ?
ANSWER: {your mother, mary, mary's mother's daughter}

CONTEXT: i am your father. my son is bob. i killed my son.
QUESTION: is bob alive ?
ANSWER: no

CONTEXT: john is my mother.
QUESTION: who is john ?
ANSWER: the reasoning proves that the context is contradictory / grammar error / incorrect format or spelling error / unsupported sentence or out of vocabulary

CONTEXT: i kills john's father
QUESTION: is john alive ?
ANSWER: the reasoning proves that the context is contradictory / grammar error / incorrect format or spelling error / unsupported sentence or out of vocabulary

CONTEXT: she kills john's father
QUESTION: is john alive ?
ANSWER: yes

Demonstration of Version 2 which is in Development

from englishai.version2 import Table, code
t = Table()
t.context(code("john is your father"))
t.context(code("mary is your mother"))
t.context(code("john is my father"))
t.context(code("mary is my mother"))
t.context(code("you are a girl"))
print(t.ask(code("who are you")))
print(t.ask(code("who is john")))
print(t.ask(code("who is mary")))
print(t.question(code("is john a boy")))
print(t.question(code("is mary a girl")))
print(t.question(code("are you john's son")))
print(t.question(code("is mary your mother")))

Output of the code

['i', "john's daughter", "mary's daughter", 'your sister']
['john', 'my father', 'your father']
['mary', 'my mother', 'your mother']
True
True
False
True

Metadata

Release files for englishai 0.4.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 englishai 0.4.3
File Size Uploaded Provenance Actions
englishai-0.4.3.tar.gz 28.3 kB Without provenance Details for englishai-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for englishai 0.4.3
File Interpreter ABI Platform Actions
englishai-0.4.3-py3-none-any.whl Python 3 none any Details for englishai-0.4.3-py3-none-any.whl

Total release size: 58.6 kB

Release files / englishai-0.4.3.tar.gz

Download URL englishai-0.4.3.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1a8f55b3e88cab09f4abfbf95e79a98ce030b388336146f40f66a94b02dcfb88
BLAKE2b-256 checksum
How to use checksums
3ba39c8609023016b12d6c740c6eb7e37e9d27e44ac216d192a5a416ad6c86b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / englishai-0.4.3-py3-none-any.whl

Download URL englishai-0.4.3-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef92c2ff67de3847c2fdf8cc2c0024399e4497af8ee563314d90f6275d2c8df5
BLAKE2b-256 checksum
How to use checksums
7e3def497d0c42814801adc43c561f9b67d9028f4c0a449f51a8a7854a4748ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for englishai 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files No provenance

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