{"id":23108987,"url":"https://github.com/shruthimohan03/basic-sentence-generation-using-ngram","last_synced_at":"2025-04-03T23:15:02.505Z","repository":{"id":232610074,"uuid":"784776574","full_name":"shruthimohan03/Basic-Sentence-Generation-using-ngram","owner":"shruthimohan03","description":"Generating similar sentences given input sentences using n-gram approach","archived":false,"fork":false,"pushed_at":"2025-02-21T08:20:58.000Z","size":2868,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T09:28:32.460Z","etag":null,"topics":["natural-language-processing","ngrams","sentence-generation"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shruthimohan03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-10T14:34:00.000Z","updated_at":"2025-02-21T08:21:01.000Z","dependencies_parsed_at":"2024-04-10T17:15:23.446Z","dependency_job_id":"18a00f6d-fe29-4c3b-bf04-46c229e28364","html_url":"https://github.com/shruthimohan03/Basic-Sentence-Generation-using-ngram","commit_stats":null,"previous_names":["shruthimohan03/basic-sentence-generation-using-ngram"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shruthimohan03%2FBasic-Sentence-Generation-using-ngram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shruthimohan03%2FBasic-Sentence-Generation-using-ngram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shruthimohan03%2FBasic-Sentence-Generation-using-ngram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shruthimohan03%2FBasic-Sentence-Generation-using-ngram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shruthimohan03","download_url":"https://codeload.github.com/shruthimohan03/Basic-Sentence-Generation-using-ngram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247092391,"owners_count":20882218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["natural-language-processing","ngrams","sentence-generation"],"created_at":"2024-12-17T01:32:09.456Z","updated_at":"2025-04-03T23:15:02.463Z","avatar_url":"https://github.com/shruthimohan03.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sentence Generation using N-grams from Text Data\n\nThis code demonstrates the process of generating sentences using an n-gram model based on a dataset of text. Here's a brief description of each part:\n\n1. Reading and Preprocessing Data:\n   - The code reads a dataset from a CSV file named 'Context.csv' using pandas.\n   - It selects only the 'Text' column from the dataset and takes a subset of the data (first 3000 rows).\n   - The text data is converted to lowercase and tokenized using NLTK's word_tokenize function.\n\n2. Creating the N-gram Model:\n   - The code defines a function named `generate_ngram` that creates n-grams (bigrams in this case) from a list of words and stores them in a dictionary named `master_ngram`.\n   - For each sentence in the preprocessed data, the `generate_ngram` function is called to create and store the n-grams in the `master_ngram` dictionary.\n\n3. Generating Sentences:\n   - Another function named `generate_sentence` is defined to generate sentences based on the provided n-gram model.\n   - Given an input sentence, the code preprocesses it, creates n-grams, and appends them to the `master_ngram` dictionary.\n   - The `generate_sentence` function then uses the input sentence and the n-gram model to generate a new sentence.\n\n4. Example Usage:\n   - The code provides three example input sentences: \"I want to understand\", \"I want to know how someone\", and \"I want to make a statement\".\n   - Each input sentence undergoes preprocessing, n-gram creation, and sentence generation using the previously defined functions.\n   - The generated sentences based on each input are printed out.\n\nOverall, this code demonstrates a basic approach to generating sentences using an n-gram model trained on a dataset of text. It shows how to preprocess the data, create the n-gram model, and use it to generate sentences based on user-provided input.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshruthimohan03%2Fbasic-sentence-generation-using-ngram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshruthimohan03%2Fbasic-sentence-generation-using-ngram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshruthimohan03%2Fbasic-sentence-generation-using-ngram/lists"}