コード例 #1
0
from python_utils.html_generator import getHtmlString
from python_utils.mermaid_flow_chart_utils import getCssFlowChartWithThreeBlock
from python_utils.model import TextPair, HighlightText, Color
from python_utils.vocab_list import generateVocabLines

with open('conditional_tara_form.md', 'w', encoding="utf-8") as f:
    f.write(printTitle('Conditional - たら (tara) form'))

    f.write(
        'The `たら` (tara) form can also be used for expressing a conditional. In order to use `たら` (tara) form, we need to use know how to convert dictionary form to past tense form. Please see how to change to past tense [here](past_tense_form.md).'
    )

    f.write('\n')
    f.write(
        getInfoBlock(
            "When you use `たら` (tara), it is usually express the speaker's will; even pure hypothetical condition."
        ))
    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.",
        [
コード例 #2
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_to_form.md', 'w', encoding="utf-8") as f:
    f.write(printTitle('Conditional - と「to」form'))

    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>')
コード例 #3
0
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')
    f.write(getInfoBlock("Here, we want to express the limitation (written language limited to Hiragana in this situation)."))
    f.write('\n')

    f.write('<br>')
    f.write('<b>Example C</b>')
コード例 #4
0
    writeNewLine(f)
    f.write('\n')

    f.write((printTitle('To describe occupation')))
    f.write('You can describe what a person does by occupation.')
    l1 = TextPair('私は 英語を 教えています。',
                  'I teach English.', [
                      HighlightText('教えて', Color.LIGHT_GREEN),
                      HighlightText('います', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    writeNewLine(f)
    f.write(
        getInfoBlock(
            'This sentence has two meanings; You are teaching English right now OR You are an English teacher. Just like in English language `I am teaching English` which can be interpreted in two ways.'
        ))
    writeNewLine(f)
    f.write((printTitle('To describe change in state')))
    writeNewLine(f)
    f.write(
        'This `ています` describe changes from one state to another; indicate the significant change from the past to the current state.'
    )
    l1 = TextPair('トムさんは ちょっと 太っています。',
                  'Tom is a little fat.', [
                      HighlightText('太って', Color.LIGHT_GREEN),
                      HighlightText('います', Color.LIGHT_PINK)
                  ],
                  addBullet=True)
    f.write(generate([l1]))
    f.write('\n')
コード例 #5
0
    f.write((printTitle('Rule 6')))
    f.write('For な-Adj: Change the last な of the な-adjective and attach なら')
    table = generateTable(
        ['Dictionary Form', 'Replacing Method', 'Conditional Form'], [
            [
                getHtmlString("元気[な]"),
                'replace the last な of the な-adjective and attach なら',
                getHtmlString("元気なら ")
            ],
        ])
    f.write(table)

    f.write(
        getInfoBlock(
            'You should attach `であれば` to な-Adj when you want to use it for writing report/formal write up because なら form is usually used in conversion.'
        ))

    f.write((printTitle('Rule 7')))
    f.write('For Noun: Attach なら to the noun')
    table = generateTable(
        ['Dictionary Form', 'Replacing Method', 'Conditional Form'], [
            [getHtmlString("雨"), 'attach なら',
             getHtmlString("雨なら ")],
        ])
    f.write(table)

    f.write(
        getInfoBlock(
            'You should attach `であれば` to Noun when you want to use it for writing report/formal write up because なら form is usually used in conversion.'
        ))
コード例 #6
0
          getHtmlString("遊んで")],
         [getHtmlString("死ぬ"), 'Replace ぬ with んで',
          getHtmlString("死んで")]])
    f.write(table)
    f.write('\n')

    f.write(printSecondaryTitle('u-verbs with final く'))
    f.write('For u-verbs ending with く, we should replace with いて.')
    table = generateTable(['Dictionary Form', 'Replacing Method', 'て-Form'], [
        [getHtmlString("書く"), 'Replace く with いて',
         getHtmlString("書いて")],
    ])
    f.write(table)
    f.write('\n')
    f.write(
        getInfoBlock('There is exception in this class. The て-form of ' +
                     getHtmlString("行く") + f'is {getHtmlString("行って")}.'))

    f.write(printSecondaryTitle('u-verbs with final ぐ'))
    f.write('For u-verbs ending with ぐ, we should replace with いで.')
    table = generateTable(['Dictionary Form', 'Replacing Method', 'て-Form'], [
        [getHtmlString("泳ぐ"), 'Replace ぐ with いで',
         getHtmlString("泳いで")],
    ])
    f.write(table)

    f.write(printSecondaryTitle('u-verbs with final す'))
    f.write('For u-verbs ending with す, we should replace with して.')
    table = generateTable(['Dictionary Form', 'Replacing Method', 'て-Form'], [
        [getHtmlString("話す"), 'Replace す with して',
         getHtmlString("話して")],
    ])