TIMAX/Logic-Translator
1
1---2title: Logic Translator3emoji: 🏢4colorFrom: yellow5colorTo: gray6sdk: gradio7sdk_version: 3.0.178app_file: app.py9pinned: true10---11 12## :hand: Intro13 14Type 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!15 16> Permalink: https://huggingface.co/spaces/TIMAX/Logic-Translator17 18## :information_source: Usage19 20Input 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. 21 22| Logic Symbol | Tag |23| :----------: | :---: |24| ∧ | AND |25| ∨ | OR |26| ¬ | NOT |27| ⊕ | XR |28| → | IMPLY |29| ↔ | EQUIV |30| ∀ | ALL |31| ∃ | EXIST |32 33The translation is **real-time**. After your input is finished, you can directly copy the result in the box of **output**.34 35Note that you can input **multi-line** sentences!36 37You will find five examples of using them below the boxes.38 39## :scroll: Source Code40 41Very simple. The core of it is just like:42 43```python44def logic(string: str):45 for word, symbol in logic_dict.items():46 string = string.replace(word, symbol)47 return string48```49 50where `logic_dict` stores all the translation between tags and logic symbols. The user interface is built with [Gradio](https://gradio.app/).51 52## :warning:Notice53 54Please 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.55 56## :email: Contact57 58If you notice any problem or have any suggestion, please contact me through [E-mail](mailto:qi11@illinois.edu) or Slack. Thanks!59 