Wug Bot 3.0 is a Discord bot designed to perform various linguistic tasks, including morphological analysis and logical representation of sentences. This bot leverages the Natural Language Toolkit (NLTK) and WordNet for its linguistic capabilities, as well as the Argos Translation library to handle translations from one language to another (13 languages)
- 🌳 Syntactic Trees: Visualize sentence structures
- 🌍 Translation: Support for 13 languages
- ✂️ Syllabification: Break down words into syllables
- 🔤 IPA Conversion: Text to International Phonetic Alphabet
- 📝 Morphological Analysis: Identify word components and transformations
- 🧮 Logical Representation: Convert sentences to logical forms
- Python 3.6+
- Discord.py
- NLTK
- WordNet
-
Clone the repository:
git clone https://github.com/yourusername/Wug-Bot-3.0.git cd Wug-Bot-3.0
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Download NLTK data:
import nltk nltk.download('punkt') nltk.download('averaged_perceptron_tagger') nltk.download('wordnet') nltk.download('treebank') nltk.download('universal_tagset')
-
Set up your .env file: Create a
.env
file in the root directory of the project and add your Discord bot token and other necessary environment variables:TOKEN=your_discord_bot_token GUILD=your_guild_id ALLOWED_CHANNELS=allowed_channel_ids OTHER_GUILD_ID=other_guild_id OTHER_CHANNEL_ID=other_channel_id
-
Run the bot:
python wug.py
-
Commands:
- Morphological Analysis: Use the command
$morphology <sentence or word>
to analyze the morphology of a sentence. - Logical Representation: Use the command
$logic <sentence>
to get the logical representation of a sentence. - Syntactic Trees: Use the command
$syntactic_tree <sentence>
to generate a syntactic tree for a sentence. - Translation: Use the command
$translate <from_lang> <to_lang> <text>
to translate text from one language to another. - Syllabification: Use the command
$syllabify <word or sentences>
to break a word into syllables. - IPA Format: Use the command
$ipa <sentence or word>
to convert the text to the International Phonetic Alphabet (IPA) format.
- Morphological Analysis: Use the command
$morphology loved.
Word Analysis: loved
Part of Speech: Verb
Base Form: loved
Morphological Process:
love → lov (e-dropping)
Root: love
Morphemes Found:
Suffix: '-ed': (inflectional, past tense)
Rule: e-dropping before -ed
$morphology carries
Word Analysis: carries
Part of Speech: Verb
Base Form: carries
Morphological Process:
carry → carr (y to i)
Root: carry
Morphemes Found:
Suffix: '-s': (inflectional, plural)
Suffix: '-es': (inflectional, plural)
Rule: y to i before -s
$morphology heroes
Word Analysis: heroes
Part of Speech: Noun
Base Form: heroes
Root: hero
Morphemes Found:
Suffix: '-s': (inflectional, plural)
Suffix: '-es': (inflectional, plural)
Rule: o to oe before -s
$morphology watches
Word Analysis: watches
Part of Speech: Noun
Base Form: watches
Root: watch
Morphemes Found:
Suffix: '-s': (inflectional, plural)
Suffix: '-es': (inflectional, plural)
Rule: ch to tch before -s
$logic The quick brown fox jumps over the lazy dog.
Logic Representation: D(The) ∧ A(quick) ∧ N(brown) ∧ N(fox) ∧ VBZ(jumps) ∧ P(over) ∧ D(the) ∧ A(lazy) ∧ N(dog) ∧ .(.)
$translate en es are you done eating or running
Translation: ¿Terminaste de comer o correr?
$syllabify are you eating or running
•••••••••••••••
Word: are (ɑɹ)
Syllable count: 1
Syllable: ɑɹ
Onset: none
Nucleus: ɑ
Coda: ɹ
•••••••••••••••
Word: you (ju)
Syllable count: 1
Syllable: ju
Onset: j
Nucleus: u
Coda: none
•••••••••••••••
Word: eating (itɪŋ)
Syllable count: 2
Syllable: i
Onset: none
Nucleus: i
Coda: none
Syllable: tɪŋ
Onset: t
Nucleus: ɪ
Coda: ŋ
•••••••••••••••
Word: or (ɔɹ)
Syllable count: 1
Syllable: ɔɹ
Onset: none
Nucleus: ɔ
Coda: ɹ
•••••••••••••••
Word: running (ɹʌnɪŋ)
Syllable count: 2
Syllable: ɹʌ
Onset: ɹ
Nucleus: ʌ
Coda: none
Syllable: nɪŋ
Onset: n
Nucleus: ɪ
Coda: ŋ
$ipa are you eating or running
IPA Translation: /ˈɑ ɹ/
IPA Translation: /j ˈu/
IPA Translation: /ˈi t ɪ ŋ/
IPA Translation: /ˈɔ ɹ/
IPA Translation: /ɹ ˈʌ n ɪ ŋ/
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
@Clyde0513 @aliiyuu