/
計算思維與解題 Computational thinking 計算思維與解題 Computational thinking

計算思維與解題 Computational thinking - PowerPoint Presentation

easyho
easyho . @easyho
Follow
342 views
Uploaded On 2020-11-06

計算思維與解題 Computational thinking - PPT Presentation

李鈺昇 Who am I and why Im here Outline Introduction U nderstanding sentences Compressing sentences Word similarity I Spelling checkers Word similarity II Arithmetics with words Introduction ID: 815903

word sentences words similarity sentences word similarity words thinking spelling computational checkers arithmetics http outline introduction understanding compressing problems

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "計算思維與解題 Computational thin..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

計算思維與解題Computational thinking

李鈺昇

Slide2

Who am I (and why I’m here)

Slide3

Outline

Introduction

U

nderstanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Slide4

Introduction

Understanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Outline

Slide5

Computational thinking is about ...

The thinking process of abstraction (or generalization)

Formalizing abstract ideas, i.e. turning thoughts into algorithms

Is a problem solvable? If so, is it easy or complex? How fast can it be solved?

Transforming or reducing complex problems into easier ones

Slide6

Computational thinking is NOT about ...

Computer programming, like learning Python or C++

(even IOI is not about this)

Understanding how computers work

Slide7

The intersection of linguistics and computational thinking

Linguists call it computational linguistics, while computer scientists call it natural language processing.

Slide8

The intersection of linguistics and computational thinking

Slide9

The intersection of linguistics and computational thinking

Slide10

Outline

Introduction

Understanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Slide11

How do we understand (English) sentences?

Usually we just process them in our brain unconsciously.

As we grow up, we automatically learn how to form “natural” or “legal” sentences without thinking too much. And we know this is called grammar.

To make things easier, we often consider context-free grammar (CFG) in Chomsky normal form (CNF):

Starting variable S and other variables A, B, C, …

Terminals a, b, c, ...

Rules of the following types:

A -> BC

A -> a (and S ->

𝟄

)

http://mdaines.github.io/grammophone/

https://web.stanford.edu/class/archive/cs/cs103/cs103.1156/tools/cfg/

Slide12

How can sentences be automatically parsed?

Parsing with shift-reduce parser.

http://nacloweb.org/resources/problems/2018/N2018-R.pdf

https://www.csie.ntu.edu.tw/~r07922087/shift-reduce-parser/

All Americans need to buy a house

is a large amount of money.

Melanie is pretty

busy.

Fat people eat

accumulates in their bodies.

Slide13

Outline

Introduction

Understanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Slide14

How to compress sentences?

Suppose you want to tell someone some string, like:

eeeeeeeeee

civic

bookkeeper

grammar

shukaihsieh

Slide15

If we assign same-length codes to each letter...

For example,

e -> 00000

s -> 00001

r -> 00010, … and so on

Then given an length-n string, the encoded string has length 5n.

Can we do it better, if we “know” the string?

Slide16

Huffman coding

Main idea: Frequent letters should be assigned shorter codes, and vice versa.

Notice that the coding should be prefix-free to avoid ambiguity.

http://ben-tanen.com/adaptive-huffman/

http://nacloweb.org/resources/problems/2013/N2013-C.pdf

Slide17

Outline

Introduction

Understanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Slide18

How do spelling checkers work?

Which pairs of the following words look similar?

gray,

great, grey, ray

, greet

sigh, sight, light, sign, flight

How do you measure similarity? What makes words look “different?”

Slide19

Levenshtein distance (a.k.a. edit distance)

http://nacloweb.org/resources/problems/2009/N2009-B.pdf

https://phiresky.github.io/levenshtein-demo/

Slide20

A simple algorithm for spelling checker

Input: w

Let v_min be something like fdlngskjfdnduvhadnlkjanf

For each word v in dictionary

Compute edit distance between v and w, say e

If e < edit distance between v_min and w

Then let v_min be v

Output: v_min

Slide21

Outline

Introduction

Understanding sentences

Compressing sentences

Word similarity I: Spelling checkers

Word similarity II: Arithmetics with words

Slide22

How to measure similarities among words?

You shall know a word by the company it keeps.

- John Rupert Firth

Slide23

Can words have some kind of arithmetics?

https://projector.tensorflow.org/

https://ronxin.github.io/wevi/

http://nacloweb.org/resources/problems/2016/N2016-K.pdf

Slide24

Thanks for your attention!