NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Sure, creating a word-wise vocabulary involves tokenizing your text into words and then creating a vocabulary from those words. Here's how you can do it using Python:

1. **Load and Preprocess Text:**
Read your Hindi and English text files, and preprocess them by removing unnecessary characters and splitting the text into sentences.

```python
def preprocess_text(text):
# Remove unnecessary characters and split into sentences
sentences = text.split('n')
return sentences

with open('hindi_file.txt', 'r', encoding='utf-8') as hindi_file:
hindi_text = hindi_file.read()

with open('english_file.txt', 'r', encoding='utf-8') as english_file:
english_text = english_file.read()

hindi_sentences = preprocess_text(hindi_text)
english_sentences = preprocess_text(english_text)
```

2. **Tokenize Sentences:**
Tokenize each sentence into words.

```python
hindi_words = [sentence.split() for sentence in hindi_sentences]
english_words = [sentence.split() for sentence in english_sentences]
```

3. **Build Vocabulary:**
Create a vocabulary by collecting all unique words from both languages.

```python
def build_vocabulary(sentences):
vocabulary = set()
for sentence in sentences:
vocabulary.update(sentence)
return vocabulary

hindi_vocabulary = build_vocabulary(hindi_words)
english_vocabulary = build_vocabulary(english_words)
```

4. **Save Vocabulary:**
Save the vocabularies to files.

```python
def save_vocabulary(vocabulary, filename):
with open(filename, 'w', encoding='utf-8') as vocab_file:
for word in vocabulary:
vocab_file.write(word + 'n')

save_vocabulary(hindi_vocabulary, 'hindi_vocab.txt')
save_vocabulary(english_vocabulary, 'english_vocab.txt')
```

Now you have created word-wise vocabularies for both Hindi and English languages. Each vocabulary file (`hindi_vocab.txt` and `english_vocab.txt`) contains one word per line.

Note: This is a basic outline, and you might need to handle special characters, punctuation, and other preprocessing steps based on your specific requirements. Additionally, consider using libraries like NLTK or spaCy for more advanced tokenization and preprocessing.
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.