-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework 1 - text generation #3
Comments
Based on your example, let's assume that you have the following 2-grams: So if e.g. you have a sequence 'bc' and you want to generate the next character for this sequence, you just look at the 3-grams, which start with 'bc'. These are: So whenever you encounter that the already generated sequence ends with 'bc' half the time you should generate the character 'a' and the other half the character 'd'. |
Thank for answering. In that situation, function output should be 'bcd' or 'bca' ? |
Not exactly. 5 is the length of the desired output. It could be much longer than 5 and you should test your solution for larger values such as 200 or 300. N is the base of the generation. If N=3 and the string ends with
you should generate You don't need to and shouldn't generate longer n-grams than N. |
Thank so much. |
Could you please write continue with that Exercise 3.2. (Define a text generator function)
word='abcabcda'
toy_freqs = count_ngram_freqs("abcabcda", 3) : {'abc': 2, 'bca': 1, 'cab': 1, 'bcd': 1, 'cda': 1}
How should we use probability? That probability is number include [0,1] and what is condition of using it?
The text was updated successfully, but these errors were encountered: