FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Viterbi Calculation Reusability + Comment Fixes by antmarakis · Pull Request #429 · aimacode/aima-python · GitHub

Repository navigation

Viterbi Calculation Reusability + Comment Fixes - #429

Closed
antmarakis wants to merge 1 commit into
aimacode:masterfrom
antmarakis:viterbi_patch
Closed

antmarakis wants to merge 1 commit into
aimacode:masterfrom
antmarakis:viterbi_patch

Conversation

antmarakis commented Mar 28, 2017 •
edited
Loading

Copy link
Copy Markdown
Collaborator

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.

Comment thread text.py
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Collaborator Author

Branch was deleted, will make a new PR.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL