Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inanyan/english-to-logic
English to logic translator
https://github.com/inanyan/english-to-logic
ai english logic nlp pattern-matching racket translator
Last synced: about 2 months ago
JSON representation
English to logic translator
- Host: GitHub
- URL: https://github.com/inanyan/english-to-logic
- Owner: InAnYan
- Created: 2023-10-27T19:51:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-08T20:19:24.000Z (about 1 year ago)
- Last Synced: 2024-01-28T22:38:12.155Z (11 months ago)
- Topics: ai, english, logic, nlp, pattern-matching, racket, translator
- Language: Racket
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# English to logic translator
A simple translator written in Racket.The program supports:
- Logic variables.
- Conjunction.
- Disjunction.
- Implication.
- Biimplication.It does not support:
- Predicates or open statements.
- Quantifiers.The program has some critical flaws that are discussed in file `notes.txt`.
## Algorithm
**Input**: an English sentence as a string.
**Output**: a pair of a logic expression (using prefix notation) and an association list of a logic variable and its string.
1. Downcase the input
2. Remove punctuation.
3. Split string into words (or tokens) by whitespace.
4. (Parsing) Recursively extract logic operators.
5. Assign variable names to `var`s and create an output.## Parsing algorithm
- The programms assumes that logical expression is written in infix notation in natural language and the precedence of logical operators is the same as in natural language.
- The parsing is organized as a set of rules (written in `match` form).
- The negation written in natural language is assumed to contain the word `not`. So it will be extracted.
- Every logical variable is converted into `'(var "...")`. It will be replaced by a symbol later.
For the details view the source code.