Giter Club home page Giter Club logo

phoneticconnector's Introduction

PhoneticConnector

A Python script that transforms phonetic symbols in an America English speech into a connected version.

For whom?

All English learners who want to master America Accent and already have a decent fundamental knowledge of pronunciation.

How to use

1.Use https://tophonetics.com/ to transform your English text (with all words correct) into phonetic symbols.
Do remember to add two / as the Parentheses and select the American English option.
2.Replace the string of input_text between ''' by the result of toPhonetics
3.Run this script by Python3, you will get the connected version printed by the program

Legend

  • '-' : General linkings. Consonant-Vowel linking, Consonant-Consonant linking when they are different and the first one is not a Stops consonant.
  • '()' : Special th sounds linking, Consonant-Consonant when they are identical and Special Consonant-Consonant +/j/ combinations.
  • '|' : Consonant-Consonant when the first one is a Stops consonant.
  • '-w-' and '-j-': Vowel-Vowel linking while glides added.

Example

The text(paragraphs are separated by line breaks):

Businesses have always sought to make a profit, but it is becoming increasingly common to hear people talk about the social obligations that companies have. I completely agree with the idea that businesses should do more for society than simply make money.
On the one hand, I accept that businesses must make money in order to survive in a competitive world. It seems logical that the priority of any company should be to cover its running costs, such as employees’ wages and payments for buildings and utilities. On top of these costs, companies also need to invest in improvements and innovations if they wish to remain successful. If a company is unable to pay its bills or meet the changing needs of customers, any concerns about social responsibilities become irrelevant. In other words, a company can only make a positive contribution to society if it is in good financial health.
On the other hand, companies should not be run with the sole aim of maximising profit; they have a wider role to play in society. One social obligation that owners and managers have is to treat their employees well, rather than exploiting them. For example, they could pay a “living wage” to ensure that workers have a good quality of life. I also like the idea that businesses could use a proportion of their profits to support local charities, environmental projects or education initiatives. Finally, instead of trying to minimise their tax payments by using accounting loopholes, I believe that company bosses should be happy to contribute to society through the tax system.
In conclusion, I believe that companies should place as much importance on their social responsibilities as they do on their financial objectives.

The toPhonetics result:

/ˈbɪznəsəz/ /həv/ /ˈɔlˌweɪz/ /sɔt/ /tə/ /meɪk/ /ə/ /ˈprɑfət/, /bət/ /ɪt/ /əz/ /bɪˈkʌmɪŋ/ /ɪnˈkrisɪŋli/ /ˈkɑmən/ /tə/ /hir/ /ˈpipəl/ /tɔk/ /əˈbaʊt/ /ðə/ /ˈsoʊʃəl/ /ˌɑbləˈɡeɪʃənz/ /ðət/ /ˈkʌmpəniz/ /hæv/. /aɪ/ /kəmˈplitli/ /əˈɡri/ /wɪð/ /ði/ /aɪˈdiə/ /ðət/ /ˈbɪznəsəz/ /ʃəd/ /dʊ/ /mɔr/ /fər/ /səˈsaɪəti/ /ðən/ /ˈsɪmpli/ /meɪk/ /ˈmʌni/.
/ɑn/ /ðə/ /wʌn/ /hænd/, /aɪ/ /ækˈsɛpt/ /ðət/ /ˈbɪznəsəz/ /məst/ /meɪk/ /ˈmʌni/ /ɪn/ /ˈɔrdər/ /tə/ /sərˈvaɪv/ /ɪn/ /ə/ /kəmˈpɛtətɪv/ /wɜrld/. /ɪt/ /simz/ /ˈlɑʤɪkəl/ /ðət/ /ðə/ /praɪˈɔrəti/ /əv/ /ˈɛni/ /ˈkʌmpəni/ /ʃəd/ /bi/ /tə/ /ˈkʌvər/ /ɪts/ /ˈrʌnɪŋ/ /kɑsts/, /sʌʧ/ /əz/ /ɛmˈplɔɪiz/ /ˈweɪʤəz/ /ənd/ /ˈpeɪmənts/ /fər/ /ˈbɪldɪŋz/ /ənd/ /juˈtɪlətiz/. /ɑn/ /tɑp/ /əv/ /ðiz/ /kɑsts/, /ˈkʌmpəniz/ /ˈɔlsoʊ/ /nid/ /tʊ/ /ɪnˈvɛst/ /ɪn/ /ɪmˈpruvmənts/ /ənd/ /ˌɪnəˈveɪʃənz/ /ɪf/ /ðeɪ/ /wɪʃ/ /tə/ /rɪˈmeɪn/ /səkˈsɛsfəl/. /ɪf/ /ə/ /ˈkʌmpəni/ /əz/ /əˈneɪbəl/ /tə/ /peɪ/ /ɪts/ /bɪlz/ /ɔr/ /mit/ /ðə/ /ˈʧeɪnʤɪŋ/ /nidz/ /əv/ /ˈkʌstəmərz/, /ˈɛni/ /kənˈsɜrnz/ /əˈbaʊt/ /ˈsoʊʃəl/ /riˌspɑnsəˈbɪlətiz/ /bɪˈkʌm/ /ɪˈrɛləvənt/. /ɪn/ /ˈʌðər/ /wɜrdz/, /ə/ /ˈkʌmpəni/ /kən/ /ˈoʊnli/ /meɪk/ /ə/ /ˈpɑzətɪv/ /ˌkɑntrəˈbjuʃən/ /tə/ /səˈsaɪəti/ /ɪf/ /ɪt/ /əz/ /ɪn/ /ɡʊd/ /fəˈnænʃəl/ /hɛlθ/.
/ɑn/ /ði/ /ˈʌðər/ /hænd/, /ˈkʌmpəniz/ /ʃəd/ /nɑt/ /bi/ /rʌn/ /wɪð/ /ðə/ /soʊl/ /eɪm/ /əv/ /ˈmæksəˌmaɪzɪŋ/ /ˈprɑfət/; /ðeɪ/ /həv/ /ə/ /ˈwaɪdər/ /roʊl/ /tə/ /pleɪ/ /ɪn/ /səˈsaɪəti/. /wʌn/ /ˈsoʊʃəl/ /ˌɑbləˈɡeɪʃən/ /ðət/ /ˈoʊnərz/ /ənd/ /ˈmænəʤərz/ /həv/ /əz/ /tə/ /trit/ /ðɛr/ /ɛmˈplɔɪiz/ /wɛl/, /ˈræðər/ /ðən/ /ˈɛkˌsplɔɪtɪŋ/ /ðɛm/. /fər/ /ɪɡˈzæmpəl/, /ðeɪ/ /kəd/ /peɪ/ /eɪ/ “/ˈlɪvɪŋ/ /weɪʤ/” /tʊ/ /ɛnˈʃʊr/ /ðət/ /ˈwɜrkərz/ /həv/ /ə/ /ɡʊd/ /ˈkwɑləti/ /əv/ /laɪf/. /aɪ/ /ˈɔlsoʊ/ /laɪk/ /ði/ /aɪˈdiə/ /ðət/ /ˈbɪznəsəz/ /kəd/ /juz/ /ə/ /prəˈpɔrʃən/ /əv/ /ðɛr/ /ˈprɑfɪts/ /tə/ /səˈpɔrt/ /ˈloʊkəl/ /ˈʧɛrətiz/, /ɪnˌvaɪrənˈmɛntəl/ /ˈprɑʤɛkts/ /ɔr/ /ˌɛʤəˈkeɪʃən/ /ɪˈnɪʃətɪvz/. /ˈfaɪnəli/, /ɪnˈstɛd/ /əv/ /ˈtraɪɪŋ/ /tə/ minimise /ðɛr/ /tæks/ /ˈpeɪmənts/ /baɪ/ /ˈjuzɪŋ/ /əˈkaʊntɪŋ/ /ˈlupˌhoʊlz/, /aɪ/ /bɪˈliv/ /ðət/ /ˈkʌmpəni/ /ˈbɔsɪz/ /ʃəd/ /bi/ /ˈhæpi/ /tə/ /kənˈtrɪbjut/ /tə/ /səˈsaɪəti/ /θru/ /ðə/ /tæks/ /ˈsɪstəm/.
/ɪn/ /kənˈkluʒən/, /aɪ/ /bɪˈliv/ /ðət/ /ˈkʌmpəniz/ /ʃəd/ /pleɪs/ /əz/ /mʌʧ/ /ɪmˈpɔrtəns/ /ɑn/ /ðɛr/ /ˈsoʊʃəl/ /riˌspɑnsəˈbɪlətiz/ /əz/ /ðeɪ/ /dʊ/ /ɑn/ /ðɛr/ /fəˈnænʃəl/ /əbˈʤɛktɪvz/.

As you can see, 'minimise' is processed mistakenly by toPhonetics. Correct it manually.

The input_text:

'''/ˈbɪznəsəz/ /həv/ /ˈɔlˌweɪz/ /sɔt/ /tə/ /meɪk/ /ə/ /ˈprɑfət/, /bət/ /ɪt/ /əz/ /bɪˈkʌmɪŋ/ /ɪnˈkrisɪŋli/ /ˈkɑmən/ /tə/ /hir/ /ˈpipəl/ /tɔk/ /əˈbaʊt/ /ðə/ /ˈsoʊʃəl/ /ˌɑbləˈɡeɪʃənz/ /ðət/ /ˈkʌmpəniz/ /hæv/. /aɪ/ /kəmˈplitli/ /əˈɡri/ /wɪð/ /ði/ /aɪˈdiə/ /ðət/ /ˈbɪznəsəz/ /ʃəd/ /dʊ/ /mɔr/ /fər/ /səˈsaɪəti/ /ðən/ /ˈsɪmpli/ /meɪk/ /ˈmʌni/.
/ɑn/ /ðə/ /wʌn/ /hænd/, /aɪ/ /ækˈsɛpt/ /ðət/ /ˈbɪznəsəz/ /məst/ /meɪk/ /ˈmʌni/ /ɪn/ /ˈɔrdər/ /tə/ /sərˈvaɪv/ /ɪn/ /ə/ /kəmˈpɛtətɪv/ /wɜrld/. /ɪt/ /simz/ /ˈlɑʤɪkəl/ /ðət/ /ðə/ /praɪˈɔrəti/ /əv/ /ˈɛni/ /ˈkʌmpəni/ /ʃəd/ /bi/ /tə/ /ˈkʌvər/ /ɪts/ /ˈrʌnɪŋ/ /kɑsts/, /sʌʧ/ /əz/ /ɛmˈplɔɪiz/ /ˈweɪʤəz/ /ənd/ /ˈpeɪmənts/ /fər/ /ˈbɪldɪŋz/ /ənd/ /juˈtɪlətiz/. /ɑn/ /tɑp/ /əv/ /ðiz/ /kɑsts/, /ˈkʌmpəniz/ /ˈɔlsoʊ/ /nid/ /tʊ/ /ɪnˈvɛst/ /ɪn/ /ɪmˈpruvmənts/ /ənd/ /ˌɪnəˈveɪʃənz/ /ɪf/ /ðeɪ/ /wɪʃ/ /tə/ /rɪˈmeɪn/ /səkˈsɛsfəl/. /ɪf/ /ə/ /ˈkʌmpəni/ /əz/ /əˈneɪbəl/ /tə/ /peɪ/ /ɪts/ /bɪlz/ /ɔr/ /mit/ /ðə/ /ˈʧeɪnʤɪŋ/ /nidz/ /əv/ /ˈkʌstəmərz/, /ˈɛni/ /kənˈsɜrnz/ /əˈbaʊt/ /ˈsoʊʃəl/ /riˌspɑnsəˈbɪlətiz/ /bɪˈkʌm/ /ɪˈrɛləvənt/. /ɪn/ /ˈʌðər/ /wɜrdz/, /ə/ /ˈkʌmpəni/ /kən/ /ˈoʊnli/ /meɪk/ /ə/ /ˈpɑzətɪv/ /ˌkɑntrəˈbjuʃən/ /tə/ /səˈsaɪəti/ /ɪf/ /ɪt/ /əz/ /ɪn/ /ɡʊd/ /fəˈnænʃəl/ /hɛlθ/.
/ɑn/ /ði/ /ˈʌðər/ /hænd/, /ˈkʌmpəniz/ /ʃəd/ /nɑt/ /bi/ /rʌn/ /wɪð/ /ðə/ /soʊl/ /eɪm/ /əv/ /ˈmæksəˌmaɪzɪŋ/ /ˈprɑfət/; /ðeɪ/ /həv/ /ə/ /ˈwaɪdər/ /roʊl/ /tə/ /pleɪ/ /ɪn/ /səˈsaɪəti/. /wʌn/ /ˈsoʊʃəl/ /ˌɑbləˈɡeɪʃən/ /ðət/ /ˈoʊnərz/ /ənd/ /ˈmænəʤərz/ /həv/ /əz/ /tə/ /trit/ /ðɛr/ /ɛmˈplɔɪiz/ /wɛl/, /ˈræðər/ /ðən/ /ˈɛkˌsplɔɪtɪŋ/ /ðɛm/. /fər/ /ɪɡˈzæmpəl/, /ðeɪ/ /kəd/ /peɪ/ /eɪ/ “/ˈlɪvɪŋ/ /weɪʤ/” /tʊ/ /ɛnˈʃʊr/ /ðət/ /ˈwɜrkərz/ /həv/ /ə/ /ɡʊd/ /ˈkwɑləti/ /əv/ /laɪf/. /aɪ/ /ˈɔlsoʊ/ /laɪk/ /ði/ /aɪˈdiə/ /ðət/ /ˈbɪznəsəz/ /kəd/ /juz/ /ə/ /prəˈpɔrʃən/ /əv/ /ðɛr/ /ˈprɑfɪts/ /tə/ /səˈpɔrt/ /ˈloʊkəl/ /ˈʧɛrətiz/, /ɪnˌvaɪrənˈmɛntəl/ /ˈprɑʤɛkts/ /ɔr/ /ˌɛʤəˈkeɪʃən/ /ɪˈnɪʃətɪvz/. /ˈfaɪnəli/, /ɪnˈstɛd/ /əv/ /ˈtraɪɪŋ/ /tə/ /ˈmɪnɪmaɪz/ /ðɛr/ /tæks/ /ˈpeɪmənts/ /baɪ/ /ˈjuzɪŋ/ /əˈkaʊntɪŋ/ /ˈlupˌhoʊlz/, /aɪ/ /bɪˈliv/ /ðət/ /ˈkʌmpəni/ /ˈbɔsɪz/ /ʃəd/ /bi/ /ˈhæpi/ /tə/ /kənˈtrɪbjut/ /tə/ /səˈsaɪəti/ /θru/ /ðə/ /tæks/ /ˈsɪstəm/.
/ɪn/ /kənˈkluʒən/, /aɪ/ /bɪˈliv/ /ðət/ /ˈkʌmpəniz/ /ʃəd/ /pleɪs/ /əz/ /mʌʧ/ /ɪmˈpɔrtəns/ /ɑn/ /ðɛr/ /ˈsoʊʃəl/ /riˌspɑnsəˈbɪlətiz/ /əz/ /ðeɪ/ /dʊ/ /ɑn/ /ðɛr/ /fəˈnænʃəl/ /əbˈʤɛktɪvz/.'''

The connected result:

/ˈbɪznəsəz/ /həv-ɔlˌweɪz-sɔ(t)ə/ /meɪk-ə/ /ˈprɑfət/, /bət-ɪt-əz/ /bɪˈkʌmɪŋ-ɪnˈkrisɪŋli/ /ˈkɑmən-tə/ /hir/ /ˈpipəl-tɔk-əˈbaʊ(tð)ə/ /ˈsoʊʃəl-ɑbləˈɡeɪʃən(zð)ət/ /ˈkʌmpəniz/ /hæv/.
/aɪ/ /kəmˈplitli-j-əˈɡri/ /wɪ(ð)i-j-aɪˈdiə/ /ðət/ /ˈbɪznəsəz-ʃə(d)ʊ/ /mɔr/ /fər/ /səˈsaɪəti/ /ðən-sɪmpli/ /meɪk/ /ˈmʌni/.

/ɑ(nð)ə/ /wʌn/ /hænd/, /aɪ-j-ækˈsɛp(tð)ət/ /ˈbɪznəsəz/ /məst/ /meɪk/ /ˈmʌni-j-ɪn-ɔrdər/ /tə/ /sərˈvaɪv-ɪn-ə/ /kəmˈpɛtətɪv-wɜrld/.
/ɪt|simz-lɑʤɪkə(lð)ə(tð)ə/ /praɪˈɔrəti-j-əv-ɛni/ /ˈkʌmpəni/ /ʃəd/ /bi/ /tə/ /ˈkʌvər-ɪts/ /ˈrʌnɪŋ-kɑsts/, /sʌʧ-əz-ɛmˈplɔɪiz/ /ˈweɪʤəz-ənd/ /ˈpeɪmənts/ /fər/ /ˈbɪldɪŋz-ən(ʤ)uˈtɪlətiz/.
/ɑn-tɑp-ə(vð)iz/ /kɑsts/, /ˈkʌmpəniz-ɔlsoʊ/ /nid|tʊ-w-ɪnˈvɛst-ɪn-ɪmˈpruvmənts-ənd-ɪnəˈveɪʃənz-ɪ(fð)eɪ/ /wɪʃ-tə/ /rɪˈmeɪn-səkˈsɛsfəl/.
/ɪf-ə/ /ˈkʌmpəni-j-əz-əˈneɪbəl-tə/ /peɪ-j-ɪts/ /bɪlz-ɔr/ /mi(tð)ə/ /ˈʧeɪnʤɪŋ/ /nidz-əv/ /ˈkʌstəmərz/, /ˈɛni/ /kənˈsɜrnz-əˈbaʊt|soʊʃəl/ /riˌspɑnsəˈbɪlətiz/ /bɪˈkʌm-ɪˈrɛləvənt/.
/ɪn-ʌðər/ /wɜrdz/, /ə/ /ˈkʌmpəni/ /kən-oʊnli/ /meɪk-ə/ /ˈpɑzətɪv/ /ˌkɑntrəˈbjuʃən-tə/ /səˈsaɪəti-j-ɪf-ɪt-əz-ɪn/ /ɡʊd/ /fəˈnænʃəl/ /hɛlθ/.

/ɑ(nð)i-j-ʌðər-hænd/, /ˈkʌmpəniz-ʃəd|nɑt/ /bi/ /rʌn/ /wɪ(ð)ə/ /soʊl-eɪm-əv-mæksəˌmaɪzɪŋ/ /ˈprɑfət/; /ðeɪ/ /həv-ə/ /ˈwaɪdə(r)oʊl-tə/ /pleɪ-j-ɪn-səˈsaɪəti/.
/wʌn-soʊʃəl-ɑbləˈɡeɪʃə(nð)ət-oʊnərz-ənd/ /ˈmænəʤərz/ /həv-əz-tə/ /tri(tð)ɛr-ɛmˈplɔɪiz/ /wɛl/, /ˈræðə(rð)ən-ɛkˌsplɔɪtɪ(ŋð)ɛm/.
/fər-ɪɡˈzæmpəl/, /ðeɪ/ /kəd/ /peɪ-j-eɪ/ “/ˈlɪvɪŋ/ /weɪʤ/” /tʊ-w-ɛnˈʃʊ(rð)ət/ /ˈwɜrkərz/ /həv-ə/ /ɡʊd/ /ˈkwɑləti-j-əv/ /laɪf/.
/aɪ-j-ɔlsoʊ/ /laɪ(kð)i-j-aɪˈdiə/ /ðət/ /ˈbɪznəsəz/ /kə(ʤ)uz-ə/ /prəˈpɔrʃən-ə(vð)ɛr/ /ˈprɑfɪts-tə/ /səˈpɔrt|loʊkəl-ʧɛrətiz/, /ɪnˌvaɪrənˈmɛntəl/ /ˈprɑʤɛkts-ɔr-ɛʤəˈkeɪʃən-ɪˈnɪʃətɪvz/.
/ˈfaɪnəli/, /ɪnˈstɛd-əv/ /ˈtraɪɪŋ/ /tə/ /ˈmɪnɪmaɪ(zð)ɛr/ /tæks/ /ˈpeɪmənts/ /baɪ/ /ˈjuzɪŋ-əˈkaʊntɪŋ/ /ˈlupˌhoʊlz/, /aɪ/ /bɪˈli(vð)ət/ /ˈkʌmpəni/ /ˈbɔsɪz-ʃəd/ /bi/ /ˈhæpi/ /tə/ /kənˈtrɪbju(t)ə/ /səˈsaɪəti/ /θru/ /ðə/ /tæk(s)ɪstəm/.

/ɪn/ /kənˈkluʒən/, /aɪ/ /bɪˈli(vð)ət/ /ˈkʌmpəniz-ʃəd/ /pleɪs-əz/ /mʌʧ-ɪmˈpɔrtəns-ɑ(nð)ɛr/ /ˈsoʊʃəl/ /riˌspɑnsəˈbɪlətiz-ə(zð)eɪ/ /dʊ-w-ɑ(nð)ɛr/ /fəˈnænʃəl-əbˈʤɛktɪvz/.


There will be a line break between sentences and an empty line between paragraphs for a convenient use. You could change it in the code if you need to.

phoneticconnector's People

Contributors

hunter-plus avatar

Watchers

 avatar

Forkers

rodrigo-rbs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.