World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
Download our e-book of Introduction To Python
4.5 (1,292 Ratings)
559 Learners
Ashish Katri
a year ago
Reading the File
FileName = ("script_file.txt")
with open(FileName, 'r') as file:
lines = file.read()
print(lines)
The format is structured so that one page equates to
roughly one minute of screen time, though this is only used as a ballpark
estimate and often bears little resemblance to the running time of the final
movie.[1] The standard font is 12 point, 10 pitch Courier Typeface.[2]
The major components are action (sometimes called
"screen direction") and dialogue. The action is written in the
present tense and is limited to what can be heard or seen by the audience, for
example descriptions of settings, character movements, or sound effects. The
dialogue is the words the characters speak, and is written in a center column.
Unique to the screenplay (as opposed to a stage play) is
the use of slug lines. A slug line, also called a master scene heading, occurs
at the start of every scene and typically contains three pieces of information:
whether the scene is set inside (interior/INT.) or outside (exterior/EXT.), the
specific location, and the time of day. Each slug line begins a new scene. In a
"shooting script" the slug lines are numbered consecutively for ease
of reference.
import nltk
FileName = ("script_file.txt")
with open(FileName, 'r') as file:
lines = file.read()
nltk_tokens = nltk.word_tokenize(lines)
print(nltk_tokens)
print("\n")
print("Number of Words: " ,len(nltk_tokens))
['The', 'format', 'is', 'structured', 'so', 'that',
'one', 'page', 'equates', 'to', 'roughly', 'one', 'minute', 'of', 'screen', 'time',
',', 'though', 'this', 'is', 'only', 'used', 'as', 'a', 'ballpark', 'estimate',
'and', 'often', 'bears', 'little', 'resemblance', 'to', 'the', 'running',
'time', 'of', 'the', 'final', 'movie', '.', '[', '1', ']', 'The', 'standard',
'font', 'is', '12', 'point', ',', '10', 'pitch', 'Courier', 'Typeface', '.',
'[', '2', ']', 'The', 'major', 'components', 'are', 'action', '(', 'sometimes',
'called', '``', 'screen', 'direction', "''", ')', 'and', 'dialogue',
'.', 'The', 'action', 'is', 'written', 'in', 'the', 'present', 'tense', 'and',
'is', 'limited', 'to', 'what', 'can', 'be', 'heard', 'or', 'seen', 'by', 'the',
'audience', ',', 'for', 'example', 'descriptions', 'of', 'settings', ',',
'character', 'movements', ',', 'or', 'sound', 'effects', '.', 'The', 'dialogue',
'is', 'the', 'words', 'the', 'characters', 'speak', ',', 'and', 'is',
'written', 'in', 'a', 'center', 'column', '.', 'Unique', 'to', 'the',
'screenplay', '(', 'as', 'opposed', 'to', 'a', 'stage', 'play', ')', 'is',
'the', 'use', 'of', 'slug', 'lines', '.', 'A', 'slug', 'line', ',', 'also',
'called', 'a', 'master', 'scene', 'heading', ',', 'occurs', 'at', 'the',
'start', 'of', 'every', 'scene', 'and', 'typically', 'contains', 'three',
'pieces', 'of', 'information', ':', 'whether', 'the', 'scene', 'is', 'set',
'inside', '(', 'interior/INT', '.', ')', 'or', 'outside', '(', 'exterior/EXT',
'.', ')', ',', 'the', 'specific', 'location', ',', 'and', 'the', 'time', 'of',
'day', '.', 'Each', 'slug', 'line', 'begins', 'a', 'new', 'scene', '.', 'In',
'a', '``', 'shooting', 'script', "''", 'the', 'slug', 'lines', 'are',
'numbered', 'consecutively', 'for', 'ease', 'of', 'reference', '.']
Number of Words:
223
FileName = ("script_file.txt")
with open(FileName, 'r') as file:
lines_in_file = file.read()
print lines_in_file.split()
print("\n")
print("Number of Words: ",len(lines_in_file.split()))
['The', 'format', 'is', 'structured', 'so', 'that',
'one', 'page', 'equates', 'to', 'roughly', 'one', 'minute', 'of', 'screen',
'time,', 'though', 'this', 'is', 'only', 'used', 'as', 'a', 'ballpark',
'estimate', 'and', 'often', 'bears', 'little', 'resemblance', 'to', 'the',
'running', 'time', 'of', 'the', 'final', 'movie.[1]', 'The', 'standard',
'font', 'is', '12', 'point,', '10', 'pitch', 'Courier', 'Typeface.[2]', 'The',
'major', 'components', 'are', 'action', '(sometimes', 'called', '"screen',
'direction")', 'and', 'dialogue.', 'The', 'action', 'is', 'written', 'in',
'the', 'present', 'tense', 'and', 'is', 'limited', 'to', 'what', 'can', 'be',
'heard', 'or', 'seen', 'by', 'the', 'audience,', 'for', 'example',
'descriptions', 'of', 'settings,', 'character', 'movements,', 'or', 'sound',
'effects.', 'The', 'dialogue', 'is', 'the', 'words', 'the', 'characters',
'speak,', 'and', 'is', 'written', 'in', 'a', 'center', 'column.', 'Unique',
'to', 'the', 'screenplay', '(as', 'opposed', 'to', 'a', 'stage', 'play)', 'is',
'the', 'use', 'of', 'slug', 'lines.', 'A', 'slug', 'line,', 'also', 'called',
'a', 'master', 'scene', 'heading,', 'occurs', 'at', 'the', 'start', 'of', 'every',
'scene', 'and', 'typically', 'contains', 'three', 'pieces', 'of',
'information:', 'whether', 'the', 'scene', 'is', 'set', 'inside',
'(interior/INT.)', 'or', 'outside', '(exterior/EXT.),', 'the', 'specific',
'location,', 'and', 'the', 'time', 'of', 'day.', 'Each', 'slug', 'line',
'begins', 'a', 'new', 'scene.', 'In', 'a', '"shooting', 'script"',
'the', 'slug', 'lines', 'are', 'numbered', 'consecutively', 'for', 'ease',
'of', 'reference.']
Number of Words:
183