I have a dictionary named ‘score’ with keys that are tuples.
Each tuple is of the form (x, y, tag).
Some possible score initializations are:
score[(0, 1, 'N')] = 1.0
score[(0, 1, 'V')] = 1.5
score[(0, 1, 'NP')] = 1.2
score[(1, 2, 'N')] = 0.2
score[(1, 2, 'PP')] = 0.1
score[(1, 2, 'V')] = 0.1
I’d like to be able to keep x and y constant (e.g. 0, 1) and then iterate over the given values for tag (e.g. N, V, NP).
Any Python geniuses out there know of ways to do this? I’m looking for multiple options on this one. Thanks.
What about a list comprehension: