NLP / TEXTBLOB Flashcards

1
Q

mean

A
def mean(sequence):
    total = 0
    for element in sequence:
        total = total + element
    return total / len(sequence)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

open text file

A

source = open(‘text-pride-and-prejudice.txt’)
pride = source.readlines()
source.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

print

A

print(pride[:100])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

calculate mean

/sentence mean

A
def mean(sequence):
    total = 0
    for element in sequence:
        total = total + element
    return total / len(sequence)
def mean_line_length(sequence):
    total = 0
    for line in sequence:
        total = total + len(line)
    return total / len(sequence)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

prose vesus verse

A
def verse_or_prose(text):
    if mean_line_length(text) < 57.82:
        return "verse"
    else:
        return "prose"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Classification

A

Classification is the process of categorizing data into discrete sets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

line.strip()

A

returns a string that has all leading and trailing whitespace removed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly