{"action":"created","issue":{"url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/17","labels_url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/17/comments","events_url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/17/events","html_url":"https://github.com/diasks2/pragmatic_segmenter/pull/17","id":124874548,"number":17,"title":"further reduce GC, define sentence starters in language modules","user":{"login":"maia","id":9836,"avatar_url":"https://avatars.githubusercontent.com/u/9836?v=3","gravatar_id":"","url":"https://api.github.com/users/maia","html_url":"https://github.com/maia","followers_url":"https://api.github.com/users/maia/followers","following_url":"https://api.github.com/users/maia/following{/other_user}","gists_url":"https://api.github.com/users/maia/gists{/gist_id}","starred_url":"https://api.github.com/users/maia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maia/subscriptions","organizations_url":"https://api.github.com/users/maia/orgs","repos_url":"https://api.github.com/users/maia/repos","events_url":"https://api.github.com/users/maia/events{/privacy}","received_events_url":"https://api.github.com/users/maia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-05T01:14:49Z","updated_at":"2016-01-05T01:25:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/pulls/17","html_url":"https://github.com/diasks2/pragmatic_segmenter/pull/17","diff_url":"https://github.com/diasks2/pragmatic_segmenter/pull/17.diff","patch_url":"https://github.com/diasks2/pragmatic_segmenter/pull/17.patch"},"body":"Two changes:\r\n 1. As `Regexp.escape(word)` creates a new string each time, it's better to only run it once per iteration. I assume there's more GC reduction possible, but this and the previous change seem to be the lowest-hanging fruits.\r\n 2. `SENTENCE_STARTERS` are now defined in their language submodules. I've kept the english sentence starters array, queried my db of a few million tweets in German for the most frequent sentence starters and added these to the german module. Certainly we'd have other words when using a more eloquent source. – Other languages will have to deal with an empty array of sentence starters."},"comment":{"url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/comments/168863168","html_url":"https://github.com/diasks2/pragmatic_segmenter/pull/17#issuecomment-168863168","issue_url":"https://api.github.com/repos/diasks2/pragmatic_segmenter/issues/17","id":168863168,"user":{"login":"maia","id":9836,"avatar_url":"https://avatars.githubusercontent.com/u/9836?v=3","gravatar_id":"","url":"https://api.github.com/users/maia","html_url":"https://github.com/maia","followers_url":"https://api.github.com/users/maia/followers","following_url":"https://api.github.com/users/maia/following{/other_user}","gists_url":"https://api.github.com/users/maia/gists{/gist_id}","starred_url":"https://api.github.com/users/maia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maia/subscriptions","organizations_url":"https://api.github.com/users/maia/orgs","repos_url":"https://api.github.com/users/maia/repos","events_url":"https://api.github.com/users/maia/events{/privacy}","received_events_url":"https://api.github.com/users/maia/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T01:25:52Z","updated_at":"2016-01-05T01:25:52Z","body":"Oh – `uninitialized constant PragmaticSegmenter::Languages::Arabic::AbbreviationReplacer::SENTENCE_STARTERS`, I assumed that the common module is the fallback for other languages and didn't test this properly, sorry! \r\n\r\n@diasks2 , any suggestions on how to solve that problem? Would you suggest adding:\r\n````ruby\r\nclass AbbreviationReplacer < AbbreviationReplacer\r\n  SENTENCE_STARTERS = [].freeze\r\nend\r\n````\r\n…to all language files, or do you have something else in mind? Thanks!"}}