{"action":"created","issue":{"url":"https://api.github.com/repos/jsvine/markovify/issues/80","repository_url":"https://api.github.com/repos/jsvine/markovify","labels_url":"https://api.github.com/repos/jsvine/markovify/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/jsvine/markovify/issues/80/comments","events_url":"https://api.github.com/repos/jsvine/markovify/issues/80/events","html_url":"https://github.com/jsvine/markovify/pull/80","id":261965913,"number":80,"title":"allow for a sentence that starts with words even of those words don't…","user":{"login":"danmayer","id":24925,"avatar_url":"https://avatars2.githubusercontent.com/u/24925?v=4","gravatar_id":"","url":"https://api.github.com/users/danmayer","html_url":"https://github.com/danmayer","followers_url":"https://api.github.com/users/danmayer/followers","following_url":"https://api.github.com/users/danmayer/following{/other_user}","gists_url":"https://api.github.com/users/danmayer/gists{/gist_id}","starred_url":"https://api.github.com/users/danmayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danmayer/subscriptions","organizations_url":"https://api.github.com/users/danmayer/orgs","repos_url":"https://api.github.com/users/danmayer/repos","events_url":"https://api.github.com/users/danmayer/events{/privacy}","received_events_url":"https://api.github.com/users/danmayer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-10-02T01:52:29Z","updated_at":"2017-11-12T21:10:17Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/jsvine/markovify/pulls/80","html_url":"https://github.com/jsvine/markovify/pull/80","diff_url":"https://github.com/jsvine/markovify/pull/80.diff","patch_url":"https://github.com/jsvine/markovify/pull/80.patch"},"body":"… start any sentence in the corpus\r\n\r\nThis adds a feature I would like which is also in this open issue: https://github.com/jsvine/markovify/issues/48\r\n\r\nbasically this would allow one to start sentences with words that exist in the corpus but never previously started sentences. \r\n\r\nI apologize for any odd style or formatting. I am not really a python programmer, but more Ruby, etc... If you want any style changes let me know or feel free to modify what I sent. "},"comment":{"url":"https://api.github.com/repos/jsvine/markovify/issues/comments/343768012","html_url":"https://github.com/jsvine/markovify/pull/80#issuecomment-343768012","issue_url":"https://api.github.com/repos/jsvine/markovify/issues/80","id":343768012,"user":{"login":"jsvine","id":534702,"avatar_url":"https://avatars2.githubusercontent.com/u/534702?v=4","gravatar_id":"","url":"https://api.github.com/users/jsvine","html_url":"https://github.com/jsvine","followers_url":"https://api.github.com/users/jsvine/followers","following_url":"https://api.github.com/users/jsvine/following{/other_user}","gists_url":"https://api.github.com/users/jsvine/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvine/subscriptions","organizations_url":"https://api.github.com/users/jsvine/orgs","repos_url":"https://api.github.com/users/jsvine/repos","events_url":"https://api.github.com/users/jsvine/events{/privacy}","received_events_url":"https://api.github.com/users/jsvine/received_events","type":"User","site_admin":false},"created_at":"2017-11-12T21:10:17Z","updated_at":"2017-11-12T21:10:17Z","author_association":"OWNER","body":"Thanks, @danmayer! I think this is getting closer. A few remaining issues:\r\n\r\n- The call to `possibleKeys` is currently placed in a `elif` block within `self.move`. But `self.move` is invoked every single time `markovify` searches for the next state, while the generation of possible keys is only required once per sentence, at the very beginning of the sentence-generation process. I think the call to `possibleKeys` would fit more cleanly and efficiently inside `self.make_sentence_with_words`. What do you think?\r\n\r\n- Given what it does, `isOrderedSubset` would seem more properly to be a function in the submodule's global scope, rather than a method of `Chain`.\r\n\r\n- I'm a bit wary of using `\"_\".join` in the `isOrderedSubset`, and more generally string-joining lists to test the subsets. What about something like this?:\r\n\r\n```python\r\ndef list_is_in_list(sub_list, super_list):\r\n    # Stop immediately if super_list is missing any of sub_list's items\r\n    if len(set(sub_list) - set(super_list)) > 0:\r\n        return False\r\n\r\n    # Iterate through sub_list-length slices of super_list\r\n    sub_len = len(sub_list)\r\n    for i in range(1 + len(super_list) - sub_len):\r\n        if super_list[i:i+sub_len] == sub_list:\r\n            return True\r\n\r\n    return False\r\n```"}}
{"actor":{"display_login":"jsvine"}}