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

Download files

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

Source Distribution

englishai-0.3.6.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

englishai-0.3.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file englishai-0.3.6.tar.gz.

File metadata

  • Download URL: englishai-0.3.6.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for englishai-0.3.6.tar.gz
Algorithm Hash digest
SHA256 bf1abdeb13fdcce48d34a683e549f1b65026aea7d33702567b827477bb50de47
MD5 456083ff56a164fadbc2eefcaa5b5ce8
BLAKE2b-256 0eb40c117299993a52f0f5686dda8b4ceadbdd95f1bc8d452ef2e6001059efe9

See more details on using hashes here.

File details

Details for the file englishai-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: englishai-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for englishai-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac47b2f2a249e27a03abe964104e6fb434e8236c46e9bc309df89ceb8cd487e7
MD5 4dc2b7bf8fa45b9945f0dac24816ad81
BLAKE2b-256 6e589f6ca6b19aa3eebfcb62e81da280f3ba382ff67092b696818bdc024a4ff6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.7

2 files

This release

0.3.6 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 files

Supported by

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