A context free grammar has these two types of nodes.
What is terminal (strings) and non-terminal (UPPERCASE)?
The data type for regular expressions in python.
What is raw string (r'')?
This invocation at the top of a script tells the command prompt which executable should be used
What is a shebang?
This approach to modeling language ignores word order.
What is bag of words (BOW)?
This flag modifies the behavior of head to only print five lines instead of the default 10.
What is -5?
When parsing using CFGs, it is preferable to reformat the rules to follow this standard, because it allows us to use that parser.
What is Chomsky Normal Form and CKY parser?
The regex shorthand for whitespace characters like tab, space, and newline.
What is \s?
The only line inside the function called get_name that title cases any one-word name provided as the argument first_name.
What is
return first_name[0].upper() + first_name[1:]
The ratio of how often a word appears across a corpus altogether, and how many entries in the corpus it appears in.
What is TF-IDF?
Names for these objects are CamelCased in python
What are classes?
In a dependency parse, there would be an arrow from this word to that word in the phrase "the cat."
What is from "cat" to "the"?
This operator indicates zero or more of the previous expression.
What is the Kleene star (*)?
The difference between a function and a method.
What is whether or not the functionality is an attribute of a specific class?
These representations of words can encode many dimensions of meaning but look out: those dimensions may not actually be meaningful.
What are word embeddings?
All of the possible elements of a command in the command line.
What are the executable/command, flags, and arguments?
The reason why this grammar isn't Chomsky Normal Form:
S -> NP VP S -> VP S -> Aux NP VP NP -> "dogs" VP -> "walk" Aux -> "do"
What is the non-terminal rules aren't binary branching?
The part of the string "abc123ABC?" that will be represented by \1 for the regex [a-z]\d(\d)[0-9]\w+
What is 2?
This code block iterates over the digits 10, 12, 14, 16, 18, 20 (without creating a variable to store them). The numbers divisible by 3 are printed to standard output.
What is
for number in range(10,21,2):
if number % 3 == 0:
print(number)In a bigram model, this is the probability p("am"|"I") for the corpus
I am Sam Sam I am I like ham
What is
p("am"|"I") = \frac{c("I am")}{c("I")} = \frac{2}{3}
The 3 special tokens we add during tokenization to accommodate sentence boundaries and unseen vocabulary.
What are BOS, EOS, and OOV (<s>, </s>, and <unk>)?
The reason this PFCG is invalid:
S -> NP VP [0.5] S -> VP [0.3] S -> Aux NP VP [0.1] NP -> "dogs" [1.0] VP -> "walk" [1.0] Aux -> "do" [0.9]
What is the probabilities for each LHS don't sum to 1?
A string accepted by (?<=M(?:r|(?:is)|s)s?\.?\s)[A-Z][a-z]+
A loop that iterates over the string values in the list variable named `animals` and prints every second string.
What is
for index in range(1,len(animals),2):
print(animals[index])The reason why raw probabilities are often not used in n-gram language models, being replaced by log probabilities.
What is underflow?
These are the class of objects raised by code when there's a problem.
What are exceptions?