Exemplo n.º 1
0
    f.write(
        f'Please see [these rules](volitional_form.md) if you want to know how to do verb conjugation for volitional form.'
    )
    writeNewLine(f)
    f.write(printTitle('Explanation'))
    f.write(
        f"You can use the volitional form with {toomotteimasu} to express what the speaker is thinking of doing. Note that when you use this expression, the decision of doing something was made some time ago. You can also use to express a third person's will or intention."
    )

    f.write(printTitle('Examples'))

    f.write('<b>Example A</b>')
    f.write('<br>')
    l1 = TextPair('週末は 海に 行こうと思っています。',
                  "I am thinking of going to the beach at the weekend.", [
                      HighlightText('行こう', Color.LIGHT_GREEN),
                      HighlightText('と 思っています', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B</b>')
    f.write('<br>')
    l1 = TextPair('今から 銀行へ 行こうと思っています。',
                  "I'm going to the bank now.", [
                      HighlightText('行こう', Color.LIGHT_GREEN),
                      HighlightText('と 思っています', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)
Exemplo n.º 2
0
        ))
    f.write('\n')

    f.write(printTitle('Conjugation Rule for たら (tara)'))
    cardText = 'Change the noun, adjective, or verb to its past tense and attach `ら` (ra) to it.'

    f.write(generateCard(cardText, [], useLeft=True))

    f.write('<br>')
    f.write('<b>Example A : Verb</b>')
    f.write('<br>')
    l1 = TextPair(
        '東京へ 来たら、 ぜひ連絡して ください。',
        "Please contact me when you come to Tokyo.",
        [
            HighlightText('来た', Color.LIGHT_GREEN),
            HighlightText('ら', Color.LIGHT_PINK, replaceAt=1)
        ],
        addBullet=True,
    )
    f.write(generate([l1]))
    writeNewLine(f)

    f.write(
        getCssFlowChartWithThreeBlock(getHtmlString('来る'),
                                      'change to past tense form',
                                      getHtmlString('来た'), 'attach ら',
                                      getHtmlString('来たら')))
    writeNewLine(f)
    f.write('<b>Example B : Verb</b>')
    f.write('<br>')
    f.write(
        "This form conveys advice or recommendation but it may also have a criticizing tone for not performing the activity that should have done already."
    )
    f.write(printTitle('Examples'))

    f.write('<b>Example A</b>')
    f.write('<br>')
    furigana = getHtmlString("勉強する")
    furigana1 = getHtmlString("勉強した")
    furigana3 = getHtmlString("勉強したらどうですか")
    f.write(
        f'{furigana} --> [convert to past tense] --> {furigana1} --> [combine with らどうですか] --> {furigana3} '
    )
    l1 = TextPair('もっと勉強したらどうですか。',
                  "Why don't you study harder?", [
                      HighlightText('勉強した', Color.LIGHT_GREEN),
                      HighlightText('らどうですか', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B</b>')
    f.write('<br>')
    furigana = getHtmlString("飲む")
    furigana1 = getHtmlString("飲んだ")
    furigana3 = getHtmlString("飲んだらどうですか")
    f.write(
        f'{furigana} --> [convert to past tense] --> {furigana1} --> [combine with らどうですか] --> {furigana3} '
    )
    l1 = TextPair('薬を飲んだらどうですか。',
                  "How about taking some medicine?", [
    f.write('The `と`「to」form can be used to express the result/event which is predictable and unavoidable due to an action.')

    f.write('\n')
    f.write(getInfoBlock("You <b>cannot</b> use `と` 「to」to express the speaker's wishes, judgement, permission, hopes, requests"))
    f.write('\n')

    f.write(printTitle('Conjugation Rule for と「to」'))
    cardText = 'Sentence: <em>[Condition]</em> `と` <em>[Result]</em> \n \n use <em>present tense short form</em> + `と`'

    f.write(generateCard(cardText, [], useLeft=True))

    f.write('<br>')
    f.write('<b>Example A</b>')
    f.write('<br>')
    l1 = TextPair('ここを押すと、ドアが 開きます。', "Press here to open the door.", [HighlightText('押す', Color.LIGHT_GREEN), HighlightText('と', Color.LIGHT_PINK)], addBullet=True, )
    f.write(generate([l1]))
    writeNewLine(f)

    f.write(getCssFlowChartWithTwoBlock(getHtmlString('押す'), 'attach と', getHtmlString('押すと'), ))
    writeNewLine(f)
    f.write('<b>Example B</b>')
    f.write('<br>')
    l1 = TextPair('メアリーさんが 国に帰ると 寂しくなります。', "When Mary returns home, we will be lonely.", [HighlightText('帰る', Color.LIGHT_GREEN), HighlightText('と', Color.LIGHT_PINK)], addBullet=True, )
    f.write(generate([l1]))

    f.write(getCssFlowChartWithTwoBlock(getHtmlString('帰る'), 'attach と', getHtmlString('帰ると'), ))
    f.write('\n')
    f.write(getInfoBlock("In this example, we are expressing the cause-effect relationship within the event"))
    f.write('\n')
from python_utils.html_generator import getHtmlString
from python_utils.mermaid_flow_chart_utils import getCssFlowChartWithTwoBlock, getCssFlowChartWithThreeBlock
from python_utils.model import TextPair, HighlightText, Color, ForceReplace
from python_utils.table_generator import generateTable
from python_utils.vocab_list import generateVocabLines

with open('conditional_form_ba.md', 'w', encoding="utf-8") as f:
    f.write('When using conditional form, first part of the sentence describes the requirement for something to happen; just like `IF` in English.')

    f.write(printTitle('Prerequisite'))
    f.write(f'Please see [these rules](conditional_form.md) if you want to know how to do verb conjugation for conditional form.')
    writeNewLine(f)
    writeNewLine(f)
    f.write('\n')
    # we need to add this dummy. otherwise, there is brake line between explanation and example sentence
    l1 = TextPair('', '', [], )
    f.write(generate([l1]))

    f.write('<b>Example A : U-Verb</b>')
    f.write('<br>')
    f.write('In this example, we should convert `押す` to `押せ` to get え equivalent sound. And then attach `ば` to obtain the final form `押せば`.')
    l1 = TextPair('ボタンを 押せば、 窓が 開きます。', "If you press the button, the window will open.", [HighlightText('押せ', Color.LIGHT_GREEN), HighlightText('ば', Color.LIGHT_PINK)], addBullet=True,
                  forceReplaceList=[ForceReplace('開き', "あき")])
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B: U-Verb</b>')
    f.write('<br>')
    f.write('In this example, we should convert `行く` to `行け` to get え equivalent sound. And then attach `ば` to obtain the final form `行けば`.')
    l1 = TextPair('彼が 行けば、私も行きます。', "If he goes, I will go too.", [HighlightText('行け', Color.LIGHT_GREEN), HighlightText('ば', Color.LIGHT_PINK)], addBullet=True)
    f.write(generate([l1]))
Exemplo n.º 6
0
                getHtmlString("読む"),
                'Replace む with お sound equivalent and attach う',
                getHtmlString("読もう")
            ],
            [
                getHtmlString("走る"),
                'Replace る with お sound equivalent and attach う',
                getHtmlString("走ろう")
            ],
        ])
    f.write(table)

    # we need to add this dummy. otherwise, there is brake line between explanation and example sentence
    l1 = TextPair(
        '',
        '',
        [],
    )
    f.write(generate([l1]))

    f.write('<b>Example A</b>')
    l1 = TextPair('夏は川で泳ごう。',
                  "Let's swim in the river in summer.",
                  [HighlightText('泳ごう', Color.LIGHT_GREEN)],
                  addBullet=True)
    f.write(generate([l1]))
    f.write(
        getCssFlowChartWithThreeBlock(getHtmlString('泳ぐ'),
                                      'replace u-vowel with the お equivalent',
                                      getHtmlString('泳ご'), 'attach う',
                                      getHtmlString('泳ごう')))
# Do something in advance

with open('v_te-form_okimasu.md', 'w') as f:
    f.write(printTitle('Usage Form'))
    f.write('\n')
    f.write(
        generateCard('V て-form + おきます', [('light_green', 'V て-form'),
                                         ('light_pink', 'おきます')]))
    f.write('\n')

    f.write((printTitle('To do something in advance; Preparation')))
    writeNewLine(f)

    l1 = TextPair('旅行の 前に切符を 買って おきます。',
                  'I will buy a ticket before the trip.', [
                      HighlightText('買って', Color.LIGHT_GREEN),
                      HighlightText('おきます', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    l1 = TextPair('来週までにレポートを書いておきます。',
                  'I will write a report by next week.', [
                      HighlightText('書いて', Color.LIGHT_GREEN),
                      HighlightText('おきます', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write((printTitle('To keep something in a certain state')))
Exemplo n.º 8
0
from python_utils.generator import printTitle, generateCard, writeNewLine, generate, getInfoBlock
from python_utils.html_generator import getHtmlString
from python_utils.mermaid_flow_chart_utils import getCssFlowChartWithTwoBlock
from python_utils.model import TextPair, HighlightText, Color
from python_utils.vocab_list import generateVocabLines

with open('conditional_nara_form.md', 'w', encoding="utf-8") as f:
    f.write(printTitle('Conditional - なら 「nara」form'))

    f.write('You can use なら 「nara」based on the situation but it is better to explain with examples. Please look at each example with an explanation.')

    f.write('<br>')
    f.write('<br>')
    f.write('<b>Example A</b>')
    f.write('<br>')
    l1 = TextPair('ブラジルに、行ったことがありますか。', 'Have you even been to Brazil?', addBullet=True, )
    l2 = TextPair('チリなら行ったことが, ブラジルは行ったことがありません。', "I've been to Chile, but never been to Brazil.", [HighlightText('なら', Color.LIGHT_GREEN)])
    f.write(generate([l1, l2]))

    f.write('\n')
    f.write(getInfoBlock("The second speaker responded with a contact sentence to show that even though he/she been to Chile, he/she never been to Brazil. "))
    f.write('\n')

    f.write('<br>')
    f.write('<b>Example B</b>')
    f.write('<br>')
    l1 = TextPair('日本語が、わかりますか。', 'Do you understand Japanese?', addBullet=True, )
    l2 = TextPair('ひらがななら わかります。', "if it is (written) in Hiragana, then yes.", [HighlightText('なら', Color.LIGHT_GREEN)])
    f.write(generate([l1, l2]))

    f.write('\n')
Exemplo n.º 9
0
    f.write(
        f'Please see [these rules](volitional_form.md) if you want to know how to do verb conjugation for volitional form.'
    )
    writeNewLine(f)

    f.write(printTitle('Explanation'))
    f.write(
        'You can use the volitional form with the question particle `か` to ask for an opinion in your offer or suggestion.'
    )

    f.write((printTitle('Examples')))

    # we need to add this dummy. otherwise, there is brake line between explanation and example sentence
    l1 = TextPair(
        '',
        '',
        [],
    )
    f.write(generate([l1]))

    f.write('<b>Example A: Using Rule 1</b>')
    l1 = TextPair('手伝おうか。',
                  "Shall I help you?", [
                      HighlightText('手伝おう', Color.LIGHT_GREEN),
                      HighlightText('か', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B: Using Rule 2</b>')
        "You can use with ながら with two verbs to express the two actions are performed at the same time. However, it cannot describe an action performed by another person."
    )
    f.write(printTitle('Examples'))

    f.write('<b>Example A</b>')
    f.write('<br>')
    furigana = getHtmlString("聞く")
    furigana1 = getHtmlString("聞き")
    furigana3 = getHtmlString("聞きながら")
    flowChart = getFlowChart(
        ["聞く", "聞き", "聞きながら"],
        ['convert dictionary to stem verb', 'combine with ながら'])
    f.write(flowChart)
    l1 = TextPair('私はいつも音楽を聞きながら日本語を勉強します。',
                  "I always study Japanese while listening to music.", [
                      HighlightText('聞き', Color.LIGHT_GREEN),
                      HighlightText('ながら', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B</b>')
    f.write('<br>')

    flowChart = getFlowChart(
        ["歌う", "歌い", "歌いながら"],
        ['convert dictionary to stem verb', 'combine with ながら'])
    f.write(flowChart)
    l1 = TextPair('彼は歌を歌いながら洗濯をしています。',
                  "He is doing laundry while singing a song.", [
                      HighlightText('歌い', Color.LIGHT_GREEN),
Exemplo n.º 11
0
    f.write(printTitle('Usage Form'))
    f.write('\n')
    f.write(
        generateCard('V て-form + います', [('light_green', 'V て-form'),
                                        ('light_pink', 'います')]))
    f.write('\n')

    f.write((printTitle('To describe continuous states')))
    writeNewLine(f)

    f.write(
        'You can describe what kind of action is in progress by using the helping verb `ている`.'
    )
    l1 = TextPair('スーさんは 今勉強 しています。',
                  'Sue is studying now.', [
                      HighlightText('して', Color.LIGHT_GREEN),
                      HighlightText('います', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)
    writeNewLine(f)
    f.write('You could also add `まだ` to show that the state is on going.')
    l1 = TextPair('まだ 雨が 降っています。',
                  'It is still raining.', [
                      HighlightText('まだ', Color.LIGHT_INDIGO),
                      HighlightText('降って', Color.LIGHT_GREEN),
                      HighlightText('います', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
Exemplo n.º 12
0
from python_utils.generator import generate, printBreakLine, generateVocab
from python_utils.model import TextPair, HighlightText, Color

l1 = TextPair('いい 先生を 紹介して いただけませんか。',
              'Would you please introduce a good teacher to me?', [
                  HighlightText('紹介して', Color.LIGHT_GREEN),
                  HighlightText('いただけませんか', Color.LIGHT_PINK)
              ],
              addBullet=True)
print(generate([l1]))
printBreakLine()
l2 = TextPair('写真を 撮って いただけませんか。',
              'Would you please take a picture?', [
                  HighlightText('撮って', Color.LIGHT_GREEN),
                  HighlightText('いただけませんか', Color.LIGHT_PINK)
              ],
              addBullet=True)
print(generate([l2]))

print('###Vocabulary')
print('<ol>')
print(generateVocab('先生 ', 'teacher'))
print(generateVocab('紹介', 'introduction'))
print(generateVocab('写真', 'photo; picture'))
print(generateVocab('撮る', 'to take (a photo)'))
print('</ol>')
Exemplo n.º 13
0
               '<b>な-adj plain form</b> + かも しれません' + '\n' + '\n' + \
               '<b>N</b> + かも しれません'

    f.write(generateCard(cardText, [], useLeft=True))

    f.write(printTitle('Explanation'))
    f.write(
        "You can use this to express the speaker's inference, and means that there is a possibility that some event or state occurred/occurs/will occur."
    )
    f.write(printTitle('Examples'))

    f.write('<b>Example A :</b> V plain form + かも しれません')
    f.write('<br>')
    l1 = TextPair('約束の 時間に 間に 合わないかもしれません。',
                  "We might not be in time for the appointment.", [
                      HighlightText('合わない', Color.LIGHT_GREEN),
                      HighlightText('かもしれません', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)

    f.write('<b>Example B : </b> い-adj plain form + かも しれません')
    f.write('<br>')
    l1 = TextPair('時期によっては少し安いかもしれません。',
                  "May be a little cheaper depending on the season.", [
                      HighlightText('安い', Color.LIGHT_GREEN),
                      HighlightText('かもしれません', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)
from python_utils.generator import generate, printBreakLine, generateVocab
from python_utils.model import TextPair, HighlightText, Color

print('###Case Study')
print(
    '(1) When the speaker gueesses the reason or the cause as to what he has seen or heard an the confirms wherther he is correct.'
)
l1 = TextPair('渡辺さんは-時々-大阪弁を-使いますね。',
              'Ms. Watanabe, you sometimes speak Osaka dialect.', [],
              addBullet=True)
l2 = TextPair('大阪に住んで いたんですか。',
              "Have you lived in Osaka?",
              highlightText=[HighlightText('んですか', Color.LIGHT_PINK)],
              addBreak=True)
l3 = TextPair('...ええ,15 歳まで 大阪に 住んで います。',
              "Yes, I lived in Osaka until I was fifteen.", [],
              forceReplaceList=[ForceReplace('歳', 'さい')])
print(generate([l1, l2, l3]))
printBreakLine()

print(
    '(2) When the speaker asks for the information about what he has been heard.'
)
l1 = TextPair(
    'おもしろい デザインの 靴ですね。どこで-買ったんですか。',
    'The design of your shoes is interesting. Where did you buy them?',
    [HighlightText('んですか', Color.LIGHT_PINK)],
    addBullet=True,
)
l2 = TextPair(
    'イドヤストアで 買いました。',