{"id":17191624,"url":"https://github.com/ugermann/ssplit-cpp","last_synced_at":"2025-04-13T20:08:06.859Z","repository":{"id":42126358,"uuid":"208876956","full_name":"ugermann/ssplit-cpp","owner":"ugermann","description":"Approximate reimplementation of the sentence splitter from the Moses toolkit.","archived":false,"fork":false,"pushed_at":"2022-04-12T14:24:55.000Z","size":219,"stargazers_count":4,"open_issues_count":4,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T00:23:01.991Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ugermann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-16T19:06:07.000Z","updated_at":"2024-02-11T12:41:28.000Z","dependencies_parsed_at":"2022-08-12T07:20:27.314Z","dependency_job_id":null,"html_url":"https://github.com/ugermann/ssplit-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ugermann%2Fssplit-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ugermann%2Fssplit-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ugermann%2Fssplit-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ugermann%2Fssplit-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ugermann","download_url":"https://codeload.github.com/ugermann/ssplit-cpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240114328,"owners_count":19749838,"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":[],"created_at":"2024-10-15T01:26:50.065Z","updated_at":"2025-02-24T00:31:30.449Z","avatar_url":"https://github.com/ugermann.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssplit-cpp\nThis is an approximate reimplementation of the sentence splitter from the Moses toolkit.\n\n- Currently doesn't support CJK character sets.\n- requires the pcre2 libraries\n  On Ubuntu, `sudo apt-get install libpcre2` should do the trick\n- The (non-breaking) prefix files included were originally copied from the Moses toolkit\n  but may have been edited there or here since they were copied.\n\n## Build instructions\n```\nmkdir build\ncd build\ncmake ..\nmake -j\n```\nThis produces an executable `ssplit`.\n\n## Usage\n\n### Command line:\n\nrun `ssplit -h` for usage instructions.\n\n### In Code (Example)\n\n```\n#include \"ssplit.h\"\n\n...\n\nstd::string prefix_file = \"path/to/moses-style/prefix-file\";\nug::ssplit::SentenceSplitter ssplit(prefix_file);\n\n...\n\nstd::string chunk_of_text = \"Sentence one. Sentence two.\\nSentence three. Sentence four.\";\nug::ssplit::splitmode mode = ug::ssplit::splitmode::one_paragraph_per_line;\nug::sssplit::SentenceStream sentence_stream(chunk_of_text, ssplit, mode);\nstd::string_view snt;\n\nwhile(sentence_stream \u003e\u003e snt) { // false means end of chunk\n  if (snt.size() == 0) {\n    // empty string_view means end of paragraph except in one_sentence_per_line mode,\n    // which just returns one line (minus leading and training whitespace) at a time\n    // For one_paragraph_per_line each empty paragraph results in snt.size() == 0\n    // twice in a row: first the em\n    ...\n  }\n  else { // this is the next non-empty paragraph\n    ...\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fugermann%2Fssplit-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fugermann%2Fssplit-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fugermann%2Fssplit-cpp/lists"}