{"action":"created","issue":{"url":"https://api.github.com/repos/woodbri/address-standardizer/issues/23","repository_url":"https://api.github.com/repos/woodbri/address-standardizer","labels_url":"https://api.github.com/repos/woodbri/address-standardizer/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/woodbri/address-standardizer/issues/23/comments","events_url":"https://api.github.com/repos/woodbri/address-standardizer/issues/23/events","html_url":"https://github.com/woodbri/address-standardizer/issues/23","id":137671087,"number":23,"title":"Tokenizer: Improving word splitting process","user":{"login":"woodbri","id":805250,"avatar_url":"https://avatars.githubusercontent.com/u/805250?v=3","gravatar_id":"","url":"https://api.github.com/users/woodbri","html_url":"https://github.com/woodbri","followers_url":"https://api.github.com/users/woodbri/followers","following_url":"https://api.github.com/users/woodbri/following{/other_user}","gists_url":"https://api.github.com/users/woodbri/gists{/gist_id}","starred_url":"https://api.github.com/users/woodbri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woodbri/subscriptions","organizations_url":"https://api.github.com/users/woodbri/orgs","repos_url":"https://api.github.com/users/woodbri/repos","events_url":"https://api.github.com/users/woodbri/events{/privacy}","received_events_url":"https://api.github.com/users/woodbri/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woodbri/address-standardizer/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-01T19:56:29Z","updated_at":"2016-03-04T03:23:01Z","closed_at":"2016-03-04T03:23:01Z","body":"This is primarily an issue for German language addresses. In German, \"CHAUSSEE\" is a street type and it might be joined to the street name. It is common to abbreviate it to \"CH\". So we desire to split words like: \"nameCHAUSSEE\" or \"nameCH\", into two tokens, one for the name and for the type. The problem comes from the short abbreviation. For example \"BACH\" gets splits \"BA\",  \"CH\". The current logic pre-splits all the attached words before it gets passed to the parser to create tokens. We could change the logic to first check if a word is in the lexicon and if it is then don't split it. \r\n\r\nAlso while this in mostly needed for separating the TYPE from the street name in German, at the time of parsing the address string into tokens we are not able to differentiate what component of the address any given token is until much later in the process. Another downside of this is that some city names have prefixes and/or suffixes that also match some of these splitting rules which makes it harder to identify them appropriately.\r\n\r\nAssuming we wanted to take this approach, the logic would be something like this:\r\n```\r\nwhile (the string has chars)\r\n   if (check if the head of the string matches a lexicon entry) {\r\n     make it a token and push it on the stream\r\n   }\r\n   else {\r\n      if (we need to split it) {\r\n         split it\r\n         push part1, emdash, part2 on token stream\r\n      }\r\n      else {\r\n         push word on token stream\r\n      }\r\n   }\r\n   push punctuation on token stream\r\n}\r\n```\r\nBut here it the problem, every word that might get split and should not be split needs to be added to the lexicon. For example every German word ending in \"ch\" and every word ending in any of the suffix attachments would need to be added if they are also common words in addresses. This could make the lexicon HUGE and I'm not sure if this worth while. For example, if BACH always gets split into BA - CH this should not impact the ability to geocode accurately.\r\n\r\nThe current work around for this is that the code generates a set of token that are split and a second set of tokens that are not split and standardized both of these, picking the best scoring match. Also by making sure that words classified as both TYPE and WORD in the lexicon can solve some of the CITY word splitting issues."},"comment":{"url":"https://api.github.com/repos/woodbri/address-standardizer/issues/comments/192080044","html_url":"https://github.com/woodbri/address-standardizer/issues/23#issuecomment-192080044","issue_url":"https://api.github.com/repos/woodbri/address-standardizer/issues/23","id":192080044,"user":{"login":"woodbri","id":805250,"avatar_url":"https://avatars.githubusercontent.com/u/805250?v=3","gravatar_id":"","url":"https://api.github.com/users/woodbri","html_url":"https://github.com/woodbri","followers_url":"https://api.github.com/users/woodbri/followers","following_url":"https://api.github.com/users/woodbri/following{/other_user}","gists_url":"https://api.github.com/users/woodbri/gists{/gist_id}","starred_url":"https://api.github.com/users/woodbri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woodbri/subscriptions","organizations_url":"https://api.github.com/users/woodbri/orgs","repos_url":"https://api.github.com/users/woodbri/repos","events_url":"https://api.github.com/users/woodbri/events{/privacy}","received_events_url":"https://api.github.com/users/woodbri/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T03:23:01Z","updated_at":"2016-03-04T03:23:01Z","body":"closing with commit 6243c40..52b233d"}}