### Tokenization with Indic NLP Library Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/00-README.md Demonstrates basic tokenization using the Indic NLP Library. Ensure the library is installed and the language code is correct. ```python from indicnlp.tokenize import indic_tokenize text = "This is a sample sentence." lang_code = "en" tokens = indic_tokenize.trivial_tokenize(text, lang_code) print(tokens) ``` -------------------------------- ### Normalize and Tokenize Text with IndicNLP Library Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/6-libraries-and-tools.md Utilize the IndicNLP library for text normalization and tokenization in Hindi. The 'indic_nlp' library must be installed. ```python from indic_nlp.tokenize import sentence_tokenize, word_tokenize from indic_nlp.normalize import normalize # Normalize text text = "हेलो वर्ल्ड।" normalized = normalize(text, lang='hi') # Tokenize sentences = sentence_tokenize(normalized, lang='hi') tokens = word_tokenize(normalized, lang='hi') ``` -------------------------------- ### Load and Use IndicBERT with Transformers Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/6-libraries-and-tools.md Load the IndicBERT tokenizer and model from Hugging Face Transformers to process Hindi text. Ensure the 'transformers' library is installed. ```python from transformers import AutoTokenizer, AutoModel # Load model tokenizer = AutoTokenizer.from_pretrained("ai4bharat/IndicBERT") model = AutoModel.from_pretrained("ai4bharat/IndicBERT") # Process text text = "यह एक हिंदी वाक्य है।" inputs = tokenizer(text, return_tensors="pt") outputs = model(**inputs) ``` -------------------------------- ### Loading a Pre-trained Model with Hugging Face Transformers Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/00-README.md Shows how to load a pre-trained model from Hugging Face Transformers. This is a common pattern for integrating various NLP models. ```python from transformers import AutoModelForSequenceClassification, AutoTokenizer model_name = "bert-base-uncased" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name) print("Model and tokenizer loaded successfully.") ``` -------------------------------- ### Indic NLP Catalog Project File Structure Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/00-README.md This listing shows the directory structure and the purpose of each file within the Indic NLP Catalog project's output documentation. ```bash /output/ ├── 00-README.md (this file) ├── INDEX.md (navigation guide) ├── 1-project-overview.md (project scope) ├── 2-text-corpora-datasets.md (150+ datasets) ├── 3-linguistic-datasets.md (structured annotations) ├── 4-models-embeddings.md (100+ pre-trained models) ├── 5-speech-and-ocr.md (speech + OCR) ├── 6-libraries-and-tools.md (software tools) └── 7-language-specific-resources.md (25+ language index) ``` -------------------------------- ### Script Conversion with Indic NLP Library Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/00-README.md Illustrates converting text from one Indic script to another using the Indic NLP Library. Ensure the correct source and target script codes are provided. ```python from indicnlp.transliterate import transliterator text = "This is a sample sentence." source_script = "latin" target_script = "bengali" converter = transliterator.Transliterator(source_script, target_script, reversed_flag=False) converted_text = converter.process(text) print(converted_text) ``` -------------------------------- ### Transliteration with Indic NLP Library Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/00-README.md Demonstrates transliterating text between scripts using the Indic NLP Library. This is useful for converting between Roman and Indic scripts. Ensure the correct language and script codes are used. ```python from indicnlp.transliterate import indic_transliterate text = "This is a sample sentence." lang_code = "en" transliterated_text = indic_transliterate.transliterate(text, lang_code, lang_code) print(transliterated_text) ``` -------------------------------- ### Markdown Format for Resource Entries Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/1-project-overview.md Use this markdown format to contribute new resource entries to the catalog. Ensure all fields are accurately filled. ```markdown [Resource Name](URL): Brief description of the dataset/model - Language coverage: List of languages - Size: Approximate scale (tokens, sentence pairs, hours, etc.) - Type: Dataset category - Access: Link to paper, repository, or download - Contributor: Person or organization identifying the resource ``` -------------------------------- ### IndicNLP Catalog File Structure Source: https://github.com/ai4bharat/indicnlp_catalog/blob/master/_autodocs/INDEX.md This snippet shows the directory structure for the IndicNLP Catalog. Each file corresponds to a specific category of resources. ```text /output/ ├── INDEX.md (this file) ├── 1-project-overview.md (project identity, scope, governance) ├── 2-text-corpora-datasets.md (text datasets: monolingual, parallel, classification, etc.) ├── 3-linguistic-datasets.md (parsing, POS, dependency, NER annotations) ├── 4-models-embeddings.md (pre-trained models, embeddings, transformers) ├── 5-speech-and-ocr.md (speech corpora, ASR data, OCR datasets) ├── 6-libraries-and-tools.md (Python libraries, frameworks, tools) └── 7-language-specific-resources.md (organized by language with cross-references) ```