Skip to content

TEAMLAB-Lecture/assignment-text-processing2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Homework - Text Processing II

๊ฐœ์š”

๋ณธ ๊ณผ์ œ์—์„œ๋Š” ์ด์ „ ๊ณผ์ œ์— ์ด์–ด์„œ string ๋‹ค๋ฃจ๋Š” ๋ฐฉ๋ฒ•์„ ํ•™์Šตํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ์ž๋ฃŒ๊ตฌ์กฐ๋ฅผ ํ•„์š”์‹œ์— ์‚ฌ์šฉํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ๋ณธ ๊ณผ์ œ์—์„œ ํ’€์–ด์•ผ ํ•  ๋ฌธ์ œ๋Š” ์•„๋ž˜ 2๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

์ˆ™์ œ ๋‹ค์šด๋กœ๋“œ ๋ฐฉ๋ฒ•

  1. ์•„๋ž˜๋งํฌ๋ฅผ ํด๋ฆญํ•˜์—ฌ ์ˆ™์ œ github repository๋ฅผ ๋ณต์‚ฌํ•จ
  2. ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ˆ™์ œ ์ฝ”๋“œ github repository๋ฅผ ์ž์‹ ์˜ ์ปดํ“จํ„ฐ๋กœ ํด๋ก ํ•จ
    git clone <๋ ˆํฌ์ง€ํ† ๋ฆฌ URL>
    
  3. ํ•ด๋‹น ํด๋”๋กœ ์ด๋™ํ•˜์—ฌ ์ž์‹ ์˜ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•จ

ํ•จ์ˆ˜ ๋ฆฌ์ŠคํŠธ

  • digits_to_words
์ธํ’‹์œผ๋กœ ๋ฐ›๋Š” ์ŠคํŠธ๋ง์—์„œ ์ˆซ์ž๋งŒ ์ถ”์ถœํ•˜์—ฌ ์˜์–ด ๋‹จ์–ด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋‹จ์–ด๋“ค์ด ์—ฐ๊ฒฐ๋œ ์ŠคํŠธ๋ง์„ ๋ฐ˜ํ™˜ํ•จ
์•„๋ž˜์˜ ์š”๊ฑด๋“ค์„ ์ถฉ์กฑ์‹œ์ผœ์•ผํ•จ
* ๋ฐ˜ํ™˜ํ•˜๋Š” ๋‹จ์–ด๋“ค์€ ์˜์–ด ์†Œ๋ฌธ์ž์—ฌ์•ผํ•จ
* ๋‹จ์–ด๋“ค ์‚ฌ์ด์—๋Š” ๋„์–ด์“ฐ๊ธฐ ํ•œ์นธ์ด ์žˆ์Œ
* ๋งŒ์•ฝ ์ธํ’‹ ์ŠคํŠธ๋ง์—์„œ ์ˆซ์ž๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋‹ค๋ฉด, ๋นˆ ๋ฌธ์ž์—ด (empty string)์„ ๋ฐ˜ํ™˜ํ•จ

    Parameters:
        input_string (string): ์˜์–ด๋กœ ๋œ ๋Œ€๋ฌธ์ž, ์†Œ๋ฌธ์ž, ๋„์–ด์“ฐ๊ธฐ, ๋ฌธ์žฅ๋ถ€ํ˜ธ, ์ˆซ์ž๋กœ ์ด๋ฃจ์–ด์ง„ string
        ex - "Zip Code: 19104"

    Returns:
        digit_string (string): ์œ„ ์š”๊ฑด์„ ์ถฉ์กฑ์‹œํ‚จ ์ˆซ์ž๋งŒ ์˜์–ด๋‹จ์–ด๋กœ ์ถ”์ถœ๋œ string
        ex - 'one nine one zero four'

    Examples:
        >>> import text_processing2 as tp2
        >>> digits_str1 = "Zip Code: 19104"
        >>> tp2.digits_to_words(digits_str1)
        'one nine one zero four'
        >>> digits_str2 = "Pi is 3.1415..."
        >>> tp2.digits_to_words(digits_str2)
        'three one four one five'
  • to_camel_case
์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์— ๋งŽ์€ ๋ช…๋ช… ๊ทœ์น™์ด ์žˆ์ง€๋งŒ, ๋‘ ๊ทœ์น™์ด ํŠนํžˆ ํ”ํžˆ ์“ฐ์ž…๋‹ˆ๋‹ค. 
์ฒซ๋ฒˆ์งธ๋กœ๋Š”, ๋ณ€์ˆ˜ ์ด๋ฆ„์„ 'underscore'๋กœ ๋‚˜๋ˆ ์ค€๋‹ค๊ฑฐ๋‚˜, (ex. under_score_variable)
๋‘๋ฒˆ์งธ๋กœ๋Š”, ๋ณ€์ˆ˜ ์ด๋ฆ„์„ ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ณ„ํ•ด ๊ตฌ๋ถ„์ž (delimiter)์—†์ด ์“ฐ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. 
์ด ๋‘๋ฒˆ์งธ์˜ ๊ฒฝ์šฐ์—๋Š” ์ฒซ๋ฒˆ์งธ ๋‹จ์–ด๋Š” ์†Œ๋ฌธ์ž๋กœ, ๊ทธ ํ›„์— ์˜ค๋Š” ๋‹จ์–ด๋“ค์˜ ์ฒซ๋ฒˆ์งธ ๊ธ€์ž๋“ค์€ ๋Œ€๋ฌธ์ž๋กœ ์“ฐ์ž…๋‹ˆ๋‹ค (ex. camelCaseVariable). 

์ด ๋ฌธ์ œ์—์„œ ์ฒซ๋ฒˆ์งธ ๊ทœ์น™ 'underscore variable' ์—์„œ ๋‘๋ฒˆ์งธ ๊ทœ์น™ 'camelcase variable'์œผ๋กœ ๋ณ€ํ™˜ํ•จ
* ์•ž๊ณผ ๋’ค์— ์—ฌ๋Ÿฌ๊ฐœ์˜ 'underscore'๋Š” ๋ฌด์‹œํ•ด๋„ ๋œ
* ๋งŒ์•ฝ ์–ด๋–ค ๋ณ€์ˆ˜ ์ด๋ฆ„์ด underscore๋กœ๋งŒ ์ด๋ฃจ์–ด ์ง„๋‹ค๋ฉด, ๋นˆ ๋ฌธ์ž์—ด๋งŒ ๋ฐ˜ํ™˜ํ•ด๋„ ๋จ

    Parameters:
        underscore_str (string): underscore case๋ฅผ ๋”ฐ๋ฅธ ์ŠคํŠธ๋ง

    Returns:
        camelcase_str (string): camelcase๋ฅผ ๋”ฐ๋ฅธ ์ŠคํŠธ๋ง

    Examples:
        >>> import text_processing2 as tp2
        >>> underscore_str1 = "to_camel_case"
        >>> tp2.to_camel_case(underscore_str1)
        'toCamelCase'
        >>> underscore_str2 = "__EXAMPLE__NAME__"
        >>> tp2.to_camel_case(underscore_str2)
        'exampleName'

์ œ์ถœ๋ฐฉ๋ฒ•

  1. ์ˆ™์ œ ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•œ ํ›„ commit ์ˆ˜ํ–‰
    git add *.py
    git commit -m "Update my code"
    
  2. ์ž์‹ ์˜ code repository์— ์ฝ”๋“œ๋ฅผ pushํ•จ
    git push origin main
    
  3. ์ž์‹ ์˜ ์ฝ”๋“œ๊ฐ€ all pass๋ฅผ ๋ฐ›์•˜๋Š”์ง€ ํ™•์ธํ•จ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages