File size: 2,178 Bytes
361cc30
 
 
 
 
 
 
 
0cc0438
361cc30
 
0cc0438
 
5668b25
0cc0438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bce7f55
 
 
0cc0438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
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!