Skip to content
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

Use Python 3 syntax #1

Open
PhilippMatthes opened this issue Nov 28, 2018 · 0 comments
Open

Use Python 3 syntax #1

PhilippMatthes opened this issue Nov 28, 2018 · 0 comments

Comments

@PhilippMatthes
Copy link

PhilippMatthes commented Nov 28, 2018

@ashwinmj, here are some recommendations for your code.

  1. Use defaultdict(list) instead of add2dict
  2. Use defaultdict(int) to replace probability_dict.get(item, 0) + 1 with probability_dict[item] + 1
  3. Use for i, token for enumerate(tokens): instead of for i in range(tokens_length):
@PhilippMatthes PhilippMatthes changed the title Use defaultdict(list) instead of add2dict Use Python 3 syntax Nov 28, 2018
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

No branches or pull requests

1 participant