LING 388: Computers and Language

Slides:



Advertisements
Similar presentations
Reading Complex Text and Exemplary Text Common Core State Standards Carrie Wozniak.
Advertisements

Elements of fiction REVIEW MS. PATTERSON. Story elements 1.The time and location in which a story takes place a)Plot b)settingc)conflict d)characterization.
 Recap – Python Basics. Python  Python is an interpreter which reads and executes a python script.  A python script is a text file, which contains.
Access and Beyond: The Concise Oxford Dictionary and Thesaurus for BrailleNote & VoiceNote JoAnn Becker.
Point of View EQ 1-When discussing a reading selection, what do we mean by point of view? ( ) (CCSS RL6)
LING 438/538 Computational Linguistics Sandiway Fong Lecture 17: 10/24.
POINT OF VIEW. Point of View Point of view is the relationship of the narrator to the story.
Reading and Writing Through Task-Based Group Work.
Great First Lines Peggy Korman CNM. First lines of a novel. The first line sets the scene, the tone, sheds just enough light on the upcoming story to.
Alice’s Adventures in Wonderland
Module 6 Unit 2 The white rabbit was looking at its watch.
English 10 Literary Terms (week two). Point of view  Is the perspective from which a story is told.
8/19/2003CS 303 – Administrivia Lecture 0 1 Administrivia Labs Homework Grades Exams Quiz.
 Life science: Cotton, Jacqueline. (2004). Polar Bears. Minneapolis, MN: Lerner.  Physical science: Simon, Seymour. (2010). Global Warming. New York:
Reading A skill to think.
ITEC 320 Lecture 10 Examples. Review Strings –What types are there? –What are the differences? –What should you use where? Homework –Hardest part –Easiest.
Leadership Team Meeting April 17, Bellringer How do you use formative assessment grades in your classroom or building?
Great First Lines Peggy Korman CNM. First lines of a novel. The first line sets the scene, the tone, sheds just enough light on the upcoming story to.
Textual Evidence: Implicit and Explicit Source:
I was watching a movie at 8 o’clock yesterday evening.
ALGEBRA – LESSON 90 Word Problems with Two Statements of Equality
Alice in Wonderland By Lewis Carroll. Down the Rabbit-Hole Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing.
Unit 2. Alice’s Adventures in Wonderland who what where Tip: Sometimes we can find the main idea of the passage from its title.
“Annabel,” said Jimmy, “give me that rose you are wearing, will you?” Hardly believing that she had heard him right, she unpinned the flower from her dress.
Metabolism and Requirements for Life Book Reading Assignment.
Counting Techniques (Dr. Monticino). Overview  Why counting?  Counting techniques  Multiplication principle  Permutation  Combination  Examples.
Getting the Most From Your Textbooks Presenter: Tim Bradley Learning Assistance Center: (503)
CSC 205 Programming II Lecture 1 PSP. The Importance of High-Quality Work Three aspects to doing an effective software engineering job producing quality.
Modifications and Accommodations – Making it Meaningful Heather Monaghan Special Education Curriculum Specialist Alvin ISD.
Welcome. Can you name this famous book? Now, can anyone name the author?
Alice’s Adventures in Wonderland by Lewis Carroll Chapter 1 - Down the Rabbit Hole.
NETW 3005 Monitors and Deadlocks. Reading For this lecture, you should have read Chapter 7. NETW3005 (Operating Systems) Lecture 06 - Deadlocks2.
Alice in Wonderland Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped.
Ms. Flath’s 9 th grade English Class Today we will: Meet each other Learn about silent conversations Do a quick comprehension check on The Count of Monte.
COSC 1200 Best Practices: homework
Interpreting School Rules
Unit 2 Is This Your Pencil?.
What Helped Dana in physics go from a 54 exam score to a 91, and end up with a 90 on the final? Dana’s Problem: She used the example problems in the book.
From Seed to Plant by Gail Gibbons
As always… Lon-Capa assignments Lecture videos Textbook Read
Clauses: Dependent and Independent
Counter Argument What’s that again???.
Discrete Structures for Computer Science
CS 154, Lecture 6: Communication Complexity
LING 388: Computers and Language
LING 388: Computers and Language
LING 388: Computers and Language
5-a-Day What’s missing from the book Alice’s sister is reading?
Lab 9 & 10: Drill 2 and Homework 4
Warm-Up Get out the origin myth you wrote yesterday and put your name on it. I will collect momentarily. Let’s name 5 things to look for when analyzing.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Text Analyzer BIS1523 – Lecture 14.
CS150 Introduction to Computer Science 1
A Man of His Words = a person who keeps promises, someone you can trust or depend on Lesson 7 p
Slowly reveal a picture
8.4 Using Systems.
Announcements Homework #2 scores in Blackboard
LING 388: Computers and Language
Unit 6 Investigation 1 Fraction Review
What do we know about division? 16 ÷ 4 = _____
Mrs.Volynskaya Alg.2 Ch.1.6 PROBABILITY
My First Ride on a Train.
Warm-Up Imagine that you live in the world of “We,” it’s your 15th birthday, and the Council of Vocations is ready to assign you a job. What job will.
Warm-Up: Take a ¼ sheet of paper.
Unit 6 I’ m watching TV. The Third Period Section B(1a-1e)
Exchange.
Study Guide(Due Today) Complete WAM Test Tomorrow
What’s your nationality? Where are you from?
Today’s Grammar Book Activities
Revision well-known 1. What's the story about? 2. What was she doing?
Presentation transcript:

LING 388: Computers and Language Lecture 11

Administrivia Homework 5 graded

List Comprehensions From last time: import re paragraph1 = 'Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do. Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book," thought Alice, "without pictures or conversations?"' paragraph2 = [re.sub("[\"',.?]", "", word) for word in paragraph1.split()]

List Comprehensions Recall also: 303 57 5.315789473684211 len(paragraph1) 303 len(paragraph2) 57 len(paragraph1)/len(paragraph2) 5.315789473684211 but that's including spaces and punctuation!

List Comprehensions How to remove spaces and punctuations from paragraph1? len(re.sub("[ \"',.?]", "", paragraph1)) 236 len(re.sub("[ \"',.?]", "", paragraph1))/len(paragraph2) 4.140350877192983

List Comprehensions [x.lower() for x in paragraph2] ['alice', 'was', 'beginning', 'to', 'get', 'very', 'tired', 'of', 'sitting', 'by', 'her', 'sister', 'on', 'the', 'bank', 'and', 'of', 'having', 'nothing', 'to', 'do', 'once', 'or', 'twice', 'she', 'had', 'peeped', 'into', 'the', 'book', 'her', 'sister', 'was', 'reading', 'but', 'it', 'had', 'no', 'pictures', 'or', 'conversations', 'in', 'it', 'and', 'what', 'is', 'the', 'use', 'of', 'a', 'book', 'thought', 'alice', 'without', 'pictures', 'or', 'conversations'] [re.sub("[.,?'\"]", "",x.lower()) for x in paragraph1.split()]  [re.sub("[.,?'\"]", "",x) for x.lower() in paragraph1.split()]   File "<stdin>", line 1 SyntaxError: can't assign to function call

List Comprehensions What does this do? from collections import Counter [re.sub("[.,?'\"]", "",x) for x in paragraph1.split() if x[0].isupper()] from collections import Counter

Counter object Compute counts of words: Counter([re.sub("[.,?'\"]", "",x.lower()) for x in paragraph1.split()]) Counter({'of': 3, 'or': 3, 'the': 3, 'conversations': 2, 'her': 2, 'sister': 2, 'book': 2, 'was': 2, 'alice': 2, 'had': 2, 'pictures': 2, 'to': 2, 'it': 2, 'and': 2, 'is': 1, 'what': 1, 'in': 1, 'twice': 1, 'she': 1, 'on': 1, 'peeped': 1, 'sitting': 1, 'a': 1, 'tired': 1, 'once': 1, 'bank': 1, 'beginning': 1, 'do': 1, 'thought': 1, 'get': 1, 'by': 1, 'no': 1, 'nothing': 1, 'having': 1, 'use': 1, 'into': 1, 'reading': 1, 'without': 1, 'very': 1, 'but': 1}) c = Counter([re.sub("[.,?'\"]", "",x.lower()) for x in paragraph1.split()]) c.most_common(5) [('of', 3), ('or', 3), ('the', 3), ('conversations', 2), ('her', 2)] c.most_common(6) [('of', 3), ('or', 3), ('the', 3), ('conversations', 2), ('her', 2), ('sister', 2)] Elements with equal counts are ordered arbitrarily

Counter object Enter this: See also from collections import Counter c = Counter() c['alice'] += 1 c['a'] += 1 c c.most_common() See also https://docs.python.org/3/library/collections.html#collections.Counter

Counter object Alternatively (from stackoverflow.com):

Homework 5 revisited http://www.bbc.com/earth/story/20160826-why-our-ancestors-drilled- holes-in-each-others-skulls

Homework 5 revisited Assume file handling: f = open("trepanation.txt") s = f.read() f.close() Let's use what we've learnt today in class …