Logic-Translator / README.md
TIMAX-159
instruction
5668b25
---
title: Logic Translator
emoji: 🏢
colorFrom: yellow
colorTo: gray
sdk: gradio
sdk_version: 3.0.17
app_file: app.py
pinned: true
---
## :hand: Intro
Type English for logic symbols! This is a simple string replacement program dedicated for typing logic symbols. Since those symbols are not on our keyboard, typing them is a little bit cumbersome. This tool allows you to type English to get them. Have fun!
> Permalink: https://huggingface.co/spaces/TIMAX/Logic-Translator
## :information_source: Usage
Input your FOL sentence in the box of **string**. If you want to type a specific logic symbol at some point of your FOL sentence, just type its corresponding tag (uppercase English words) instead, and keep everything else the same.
| Logic Symbol | Tag |
| :----------: | :---: |
| ∧ | AND |
| ∨ | OR |
| ¬ | NOT |
| ⊕ | XR |
| → | IMPLY |
| ↔ | EQUIV |
| ∀ | ALL |
| ∃ | EXIST |
The translation is **real-time**. After your input is finished, you can directly copy the result in the box of **output**.
Note that you can input **multi-line** sentences!
You will find five examples of using them below the boxes.
## :scroll: Source Code
Very simple. The core of it is just like:
```python
def logic(string: str):
for word, symbol in logic_dict.items():
string = string.replace(word, symbol)
return string
```
where `logic_dict` stores all the translation between tags and logic symbols. The user interface is built with [Gradio](https://gradio.app/).
## :warning:Notice
Please don’t include the ==exact same uppercase spelling== of any of the tags in your FOL sentence if you don’t mean it, or the program will replace them without thinking. For example, it your input sentence is: **WALL(berlin wall)** meaning “berlin wall is a wall”, the program output would be **W∀(berlin wall)** with the **ALL** after **W** replaced by **∀**, which is not what you want.
## :email: Contact
If you notice any problem or have any suggestion, please contact me through [E-mail](mailto:qi11@illinois.edu) or Slack. Thanks!