Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Viterbi Calculation Reusability + Comment Fixes#429

Closed
antmarakis wants to merge 1 commit intoaimacode:masteraimacode/aima-python:masterfrom
antmarakis:viterbi_patchCopy head branch name to clipboard
Closed

Viterbi Calculation Reusability + Comment Fixes#429
antmarakis wants to merge 1 commit intoaimacode:masteraimacode/aima-python:masterfrom
antmarakis:viterbi_patchCopy head branch name to clipboard

Conversation

@antmarakis
Copy link
Collaborator

@antmarakis antmarakis commented Mar 28, 2017

In viterbi_segment, the calculation P[w] * best[i - len(w)] is used twice in a row, so I stored it into a variable (curr_score) and used that instead.

Also made quotation and spacing fixes to the comments.

w = text[j:i]
if P[w] * best[i - len(w)] >= best[i]:
best[i] = P[w] * best[i - len(w)]
curr_score = P[w] * best[i - len(w)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen curr_something (or currSomething etc.) pop up a lot around, so I assume most people will get it. The problem with p_score is that p doesn't give enough information, which is not the same case as curr_score.

I personally feel it's fine, but I don't feel strongly about it. If more have the same issue, I will change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I'm sure most won't have an issue.

@antmarakis
Copy link
Collaborator Author

Branch was deleted, will make a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.