Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06af67e

Browse files
roberthoenignorvig
authored andcommitted
Fix various typos. (#750)
1 parent eae217b commit 06af67e

23 files changed

+64
-64
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In more detail:
2323

2424
## Port to Python 3; Pythonic Idioms; py.test
2525

26-
- Check for common problems in [porting to Python 3](http://python3porting.com/problems.html), such as: `print` is now a function; `range` and `map` and other functions no longer produce `list`s; objects of different types can no longer be compared with `<`; strings are now Unicode; it would be nice to move `%` string formating to `.format`; there is a new `next` function for generators; integer division now returns a float; we can now use set literals.
26+
- Check for common problems in [porting to Python 3](http://python3porting.com/problems.html), such as: `print` is now a function; `range` and `map` and other functions no longer produce `list`s; objects of different types can no longer be compared with `<`; strings are now Unicode; it would be nice to move `%` string formatting to `.format`; there is a new `next` function for generators; integer division now returns a float; we can now use set literals.
2727
- Replace old Lisp-based idioms with proper Python idioms. For example, we have many functions that were taken directly from Common Lisp, such as the `every` function: `every(callable, items)` returns true if every element of `items` is callable. This is good Lisp style, but good Python style would be to use `all` and a generator expression: `all(callable(f) for f in items)`. Eventually, fix all calls to these legacy Lisp functions and then remove the functions.
2828
- Add more tests in `test_*.py` files. Strive for terseness; it is ok to group multiple asserts into one `def test_something():` function. Move most tests to `test_*.py`, but it is fine to have a single `doctest` example in the docstring of a function in the `.py` file, if the purpose of the doctest is to explain how to use the function, rather than test the implementation.
2929

@@ -83,7 +83,7 @@ Reporting Issues
8383

8484
- Under which versions of Python does this happen?
8585

86-
- Provide an example of the issue occuring.
86+
- Provide an example of the issue occurring.
8787

8888
- Is anybody working on this?
8989

agents.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@
566566
" print('{} decided to move {}wards at location: {}'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
567567
" agent.moveforward()\n",
568568
" else:\n",
569-
" print('{} decided to move {}wards at location: {}, but couldnt'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
569+
" print('{} decided to move {}wards at location: {}, but couldn\\'t'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
570570
" agent.moveforward(False)\n",
571571
" elif action == \"eat\":\n",
572572
" items = self.list_things_at(agent.location, tclass=Food)\n",
@@ -605,17 +605,17 @@
605605
"EnergeticBlindDog decided to move downwards at location: [0, 1]\n",
606606
"EnergeticBlindDog drank Water at location: [0, 2]\n",
607607
"EnergeticBlindDog decided to turnright at location: [0, 2]\n",
608-
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldnt\n",
608+
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldn't\n",
609609
"EnergeticBlindDog decided to turnright at location: [0, 2]\n",
610610
"EnergeticBlindDog decided to turnright at location: [0, 2]\n",
611611
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
612612
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
613-
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldnt\n",
613+
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldn't\n",
614614
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
615615
"EnergeticBlindDog decided to turnright at location: [0, 2]\n",
616-
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldnt\n",
616+
"EnergeticBlindDog decided to move leftwards at location: [0, 2], but couldn't\n",
617617
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
618-
"EnergeticBlindDog decided to move downwards at location: [0, 2], but couldnt\n",
618+
"EnergeticBlindDog decided to move downwards at location: [0, 2], but couldn't\n",
619619
"EnergeticBlindDog decided to turnright at location: [0, 2]\n",
620620
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
621621
"EnergeticBlindDog decided to turnleft at location: [0, 2]\n",
@@ -684,7 +684,7 @@
684684
" print('{} decided to move {}wards at location: {}'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
685685
" agent.moveforward()\n",
686686
" else:\n",
687-
" print('{} decided to move {}wards at location: {}, but couldnt'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
687+
" print('{} decided to move {}wards at location: {}, but couldn\\'t'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
688688
" agent.moveforward(False)\n",
689689
" elif action == \"eat\":\n",
690690
" items = self.list_things_at(agent.location, tclass=Food)\n",
@@ -1012,7 +1012,7 @@
10121012
"name": "stdout",
10131013
"output_type": "stream",
10141014
"text": [
1015-
"EnergeticBlindDog decided to move leftwards at location: [0, 3], but couldnt\n"
1015+
"EnergeticBlindDog decided to move leftwards at location: [0, 3], but couldn't\n"
10161016
]
10171017
},
10181018
{
@@ -1069,7 +1069,7 @@
10691069
"name": "stdout",
10701070
"output_type": "stream",
10711071
"text": [
1072-
"EnergeticBlindDog decided to move leftwards at location: [0, 3], but couldnt\n"
1072+
"EnergeticBlindDog decided to move leftwards at location: [0, 3], but couldn't\n"
10731073
]
10741074
},
10751075
{

csp.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@
647647
"source": [
648648
"## TREE CSP SOLVER\n",
649649
"\n",
650-
"The `tree_csp_solver` function (**Figure 6.11** in the book) can be used to solve problems whose constraint graph is a tree. Given a CSP, with `neighbors` forming a tree, it returns an assignement that satisfies the given constraints. The algorithm works as follows:\n",
650+
"The `tree_csp_solver` function (**Figure 6.11** in the book) can be used to solve problems whose constraint graph is a tree. Given a CSP, with `neighbors` forming a tree, it returns an assignment that satisfies the given constraints. The algorithm works as follows:\n",
651651
"\n",
652652
"First it finds the *topological sort* of the tree. This is an ordering of the tree where each variable/node comes after its parent in the tree. The function that accomplishes this is `topological_sort`, which builds the topological sort using the recursive function `build_topological`. That function is an augmented DFS, where each newly visited node of the tree is pushed on a stack. The stack in the end holds the variables topologically sorted.\n",
653653
"\n",
@@ -896,7 +896,7 @@
896896
"\n",
897897
"visualize_callback = make_visualize(iteration_slider)\n",
898898
"\n",
899-
"visualize_button = widgets.ToggleButton(desctiption = \"Visualize\", value = False)\n",
899+
"visualize_button = widgets.ToggleButton(description = \"Visualize\", value = False)\n",
900900
"time_select = widgets.ToggleButtons(description='Extra Delay:',options=['0', '0.1', '0.2', '0.5', '0.7', '1.0'])\n",
901901
"\n",
902902
"a = widgets.interactive(visualize_callback, Visualize = visualize_button, time_step=time_select)\n",
@@ -1055,7 +1055,7 @@
10551055
"\n",
10561056
"visualize_callback = make_visualize(iteration_slider)\n",
10571057
"\n",
1058-
"visualize_button = widgets.ToggleButton(desctiption = \"Visualize\", value = False)\n",
1058+
"visualize_button = widgets.ToggleButton(description = \"Visualize\", value = False)\n",
10591059
"time_select = widgets.ToggleButtons(description='Extra Delay:',options=['0', '0.1', '0.2', '0.5', '0.7', '1.0'])\n",
10601060
"\n",
10611061
"a = widgets.interactive(visualize_callback, Visualize = visualize_button, time_step=time_select)\n",
@@ -1138,7 +1138,7 @@
11381138
"\n",
11391139
"visualize_callback = make_visualize(iteration_slider)\n",
11401140
"\n",
1141-
"visualize_button = widgets.ToggleButton(desctiption = \"Visualize\", value = False)\n",
1141+
"visualize_button = widgets.ToggleButton(description = \"Visualize\", value = False)\n",
11421142
"time_select = widgets.ToggleButtons(description='Extra Delay:',options=['0', '0.1', '0.2', '0.5', '0.7', '1.0'])\n",
11431143
"\n",
11441144
"a = widgets.interactive(visualize_callback, Visualize = visualize_button, time_step=time_select)\n",

games.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
"\n",
211211
"<img src=\"images/fig_5_2.png\" width=\"75%\">\n",
212212
"\n",
213-
"The states are represented wih capital letters inside the triangles (eg. \"A\") while moves are the labels on the edges between states (eg. \"a1\"). Terminal nodes carry utility values. Note that the terminal nodes are named in this example 'B1', 'B2' and 'B2' for the nodes below 'B', and so forth.\n",
213+
"The states are represented with capital letters inside the triangles (eg. \"A\") while moves are the labels on the edges between states (eg. \"a1\"). Terminal nodes carry utility values. Note that the terminal nodes are named in this example 'B1', 'B2' and 'B2' for the nodes below 'B', and so forth.\n",
214214
"\n",
215215
"We will model the moves, utilities and initial state like this:"
216216
]

gui/xy_vacuum_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def update_env(self):
124124
xf, yf = agt.location
125125

126126
def reset_env(self, agt):
127-
"""Resets the GUI environment to the intial state."""
127+
"""Resets the GUI environment to the initial state."""
128128
self.read_env()
129129
for i, btn_row in enumerate(self.buttons):
130130
for j, btn in enumerate(btn_row):

learning.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@
10651065
"source": [
10661066
"The implementation of `DecisionTreeLearner` provided in [learning.py](https://github.com/aimacode/aima-python/blob/master/learning.py) uses information gain as the metric for selecting which attribute to test for splitting. The function builds the tree top-down in a recursive manner. Based on the input it makes one of the four choices:\n",
10671067
"<ol>\n",
1068-
"<li>If the input at the current step has no training data we return the mode of classes of input data recieved in the parent step (previous level of recursion).</li>\n",
1068+
"<li>If the input at the current step has no training data we return the mode of classes of input data received in the parent step (previous level of recursion).</li>\n",
10691069
"<li>If all values in training data belong to the same class it returns a `DecisionLeaf` whose class label is the class which all the data belongs to.</li>\n",
10701070
"<li>If the data has no attributes that can be tested we return the class with highest plurality value in the training data.</li>\n",
10711071
"<li>We choose the attribute which gives the highest amount of entropy gain and return a `DecisionFork` which splits based on this attribute. Each branch recursively calls `decision_tree_learning` to construct the sub-tree.</li>\n",
@@ -1155,7 +1155,7 @@
11551155
"\n",
11561156
"*a)* The probability of **Class** in the dataset.\n",
11571157
"\n",
1158-
"*b)* The conditional probability of each feature occuring in an item classified in **Class**.\n",
1158+
"*b)* The conditional probability of each feature occurring in an item classified in **Class**.\n",
11591159
"\n",
11601160
"*c)* The probabilities of each individual feature.\n",
11611161
"\n",
@@ -1339,7 +1339,7 @@
13391339
"source": [
13401340
"You can see the means of the features for the \"Setosa\" class and the deviations for \"Versicolor\".\n",
13411341
"\n",
1342-
"The prediction function will work similarly to the Discrete algorithm. It will multiply the probability of the class occuring with the conditional probabilities of the feature values for the class.\n",
1342+
"The prediction function will work similarly to the Discrete algorithm. It will multiply the probability of the class occurring with the conditional probabilities of the feature values for the class.\n",
13431343
"\n",
13441344
"Since we are using the Gaussian distribution, we will input the value for each feature into the Gaussian function, together with the mean and deviation of the feature. This will return the probability of the particular feature value for the given class. We will repeat for each class and pick the max value."
13451345
]

logic.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@
766766
"metadata": {},
767767
"source": [
768768
"<em>\"Nono ... has some missiles\"</em><br/>\n",
769-
"This states the existance of some missile which is owned by Nono. $\\exists x \\text{Owns}(\\text{Nono}, x) \\land \\text{Missile}(x)$. We invoke existential instantiation to introduce a new constant `M1` which is the missile owned by Nono.\n",
769+
"This states the existence of some missile which is owned by Nono. $\\exists x \\text{Owns}(\\text{Nono}, x) \\land \\text{Missile}(x)$. We invoke existential instantiation to introduce a new constant `M1` which is the missile owned by Nono.\n",
770770
"\n",
771771
"$\\text{Owns}(\\text{Nono}, \\text{M1}), \\text{Missile}(\\text{M1})$"
772772
]

mdp.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
"cell_type": "markdown",
330330
"metadata": {},
331331
"source": [
332-
"With this we have sucessfully represented our MDP. Later we will look at ways to solve this MDP."
332+
"With this we have successfully represented our MDP. Later we will look at ways to solve this MDP."
333333
]
334334
},
335335
{
@@ -919,7 +919,7 @@
919919
"\n",
920920
"visualize_callback = make_visualize(iteration_slider)\n",
921921
"\n",
922-
"visualize_button = widgets.ToggleButton(desctiption = \"Visualize\", value = False)\n",
922+
"visualize_button = widgets.ToggleButton(description = \"Visualize\", value = False)\n",
923923
"time_select = widgets.ToggleButtons(description='Extra Delay:',options=['0', '0.1', '0.2', '0.5', '0.7', '1.0'])\n",
924924
"a = widgets.interactive(visualize_callback, Visualize = visualize_button, time_step=time_select)\n",
925925
"display(a)"

0 commit comments

Comments
 (0)