{"id":21557051,"url":"https://github.com/linguistic-dev/n-gram-extractor","last_synced_at":"2025-07-22T03:31:31.403Z","repository":{"id":57015200,"uuid":"113239488","full_name":"linguistic-dev/n-gram-extractor","owner":"linguistic-dev","description":"A PHP Library to extract n-grams from a text. Simple preprocessing tools (cleaning, tokenizing) included.","archived":false,"fork":false,"pushed_at":"2017-12-05T23:09:36.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-17T09:53:09.968Z","etag":null,"topics":["natural-language-processing","ngram","ngram-analysis","ngrams","nlp","php","php-library","php7","tokenization","tokenize","tokenized-sentences","tokenizer"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linguistic-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-05T22:23:34.000Z","updated_at":"2022-02-12T14:33:25.000Z","dependencies_parsed_at":"2022-08-22T09:30:24.939Z","dependency_job_id":null,"html_url":"https://github.com/linguistic-dev/n-gram-extractor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linguistic-dev/n-gram-extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguistic-dev%2Fn-gram-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguistic-dev%2Fn-gram-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguistic-dev%2Fn-gram-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguistic-dev%2Fn-gram-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linguistic-dev","download_url":"https://codeload.github.com/linguistic-dev/n-gram-extractor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linguistic-dev%2Fn-gram-extractor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266419224,"owners_count":23925716,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ngram","ngram-analysis","ngrams","nlp","php","php-library","php7","tokenization","tokenize","tokenized-sentences","tokenizer"],"created_at":"2024-11-24T08:10:47.373Z","updated_at":"2025-07-22T03:31:31.372Z","avatar_url":"https://github.com/linguistic-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NGramExtractor for PHP\r\n\r\n## Installation\r\n\r\nSimple install via Composer:\r\n\r\n```\r\ncomposer require linguistic/ngramextractor\r\n```\r\n\r\n## Usage\r\n\r\nComing soon.\r\n\r\n## Example\r\n\r\n```php\r\n$tokenizer = new Tokenizer();\r\n$tokenizer-\u003eaddRemovalRule('/\u003c\\/?\\w+[\\s\\w\\=\\\"\\/\\#\\-\\:\\.\\_]*\u003e/') # Removes HTML Tags\r\n-\u003eaddRemovalRule('/[^a-z0-9]+/', ' ') # Replaces everything which is not text with a space\r\n-\u003esetSeperator('/\\s+/'); # Tokenizes text with whitespace as delimiter\r\n```\r\n\r\n```php\r\n$content = \"\"; # The text that should get tokenized\r\n$stopwords = array(); # (optional) array of stopwords\r\n\r\n$extractor = new NGramExtractor($content, $tokenizer, $stopwords);\r\n$unigrams    = $extractor-\u003egetNGrams(1); # gets all n-grams in the text, n = 1\r\n\r\n$unigramsFiltered    = NGramExtractor::limitByOccurance($extractor-\u003egetNGramCount(1, true), 3); # get unigrams and their occurance if the occurance is greater or equal 3\r\n```\r\n## Ressources\r\n\r\n* [Download of stopword lists for different languages](http://members.unine.ch/jacques.savoy/clef/index.html)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinguistic-dev%2Fn-gram-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinguistic-dev%2Fn-gram-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinguistic-dev%2Fn-gram-extractor/lists"}