Unverified Commit a2dc8571 authored by Andreas Krüger's avatar Andreas Krüger
Browse files

Koch method for learning Morse code with real words: Initial public commit.

parents
*.kmrw
*/*.kmrw
__pycache__
*/lettercount.txt
*/letterset2count.kmrw
*/wordlist.txt
FROM debian:buster
MAINTAINER dj3ei@famsik.de
# This is mainly for my convenience, as it uses the Debian server
# that happens to serve my place fastes. Delete this line if you don't like it.
COPY ["sources.list", "/etc/apt/sources.list"]
COPY ["generate_wordlist.py", "count_letters.py", "letter2bitmask.py", "mk_bin_file.py", "find_learning_order.py", "", "/usr/local/bin/"]
COPY ["letters_rare_first.py", "mk_lessons.py", "/usr/local/lib/python3.7/dist-packages/"]
COPY ["tasks.py", "/"]
RUN set -x; apt-get update && apt-get --yes upgrade && \
apt-get --yes install hunspell-de-de-frami hunspell-en-us hunspell-en-gb hunspell-tools python3-pip && \
pip3 install invoke && \
ln /usr/local/bin/generate_wordlist.py /usr/local/bin/count_letters.py /usr/local/bin/letter2bitmask.py /usr/local/bin/mk_bin_file.py /usr/local/bin/find_learning_order.py /usr/local/lib/python3.7/dist-packages && \
python3 -m compileall && \
mkdir -p /fromhost
Koch method to learn Morse code using real words.
Copyright (c) 2017-2020 Andreas Krüger, DJ3EI, dj3ei@famsik.de.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
This diff is collapsed.
#!/usr/bin/env python3
import argparse
import sys
def count(infile, outfile):
result = {}
for _,c in enumerate("abcdefghijklmnopqrstuvwxyz"):
result[c] = 0
for word in infile:
for c in set(word):
if c != "\n":
result[c] += 1
for c, count in sorted([[k,v] for k,v in result.items()],
key=lambda kv: kv[1],
reverse=True):
outfile.write("{}: {}\n".format(c,count))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Count, for each letter, in how many words it occurs.")
parser.add_argument("--in",
dest="infile",
default="wordlist.txt",
type=argparse.FileType("r", encoding="UTF-8"),
help="wordlist.txt file as generated by generate-wordlist")
parser.add_argument("--out",
type=argparse.FileType("w", encoding="UTF-8"),
required=False,
default="lettercount.txt",
help="The output file with letters and counts.")
args = parser.parse_args()
count(args.infile, args.out)
{
"lesson_01": {
"letters": [
"a",
"p",
"s"
],
"new_words": 21,
"words_total": 21
},
"lesson_02": {
"new_letter": "t",
"old_letters": [
"a",
"p",
"s"
],
"new_words": 29,
"words_total": 50
},
"lesson_03": {
"new_letter": "e",
"old_letters": [
"a",
"p",
"s",
"t"
],
"new_words": 100,
"words_total": 150
},
"lesson_04": {
"new_letter": "l",
"old_letters": [
"a",
"e",
"p",
"s",
"t"
],
"new_words": 142,
"words_total": 292
},
"lesson_05": {
"new_letter": "b",
"old_letters": [
"a",
"e",
"l",
"p",
"s",
"t"
],
"new_words": 164,
"words_total": 456
},
"lesson_06": {
"new_letter": "f",
"old_letters": [
"a",
"b",
"e",
"l",
"p",
"s",
"t"
],
"new_words": 120,
"words_total": 576
},
"lesson_07": {
"new_letter": "d",
"old_letters": [
"a",
"b",
"e",
"f",
"l",
"p",
"s",
"t"
],
"new_words": 120,
"words_total": 696
},
"lesson_08": {
"new_letter": "m",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"l",
"p",
"s",
"t"
],
"new_words": 234,
"words_total": 930
},
"lesson_09": {
"new_letter": "g",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"l",
"m",
"p",
"s",
"t"
],
"new_words": 280,
"words_total": 1210
},
"lesson_10": {
"new_letter": "z",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"g",
"l",
"m",
"p",
"s",
"t"
],
"new_words": 120,
"words_total": 1330
},
"lesson_11": {
"new_letter": "w",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"g",
"l",
"m",
"p",
"s",
"t",
"z"
],
"new_words": 131,
"words_total": 1461
},
"lesson_12": {
"new_letter": "k",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"g",
"l",
"m",
"p",
"s",
"t",
"w",
"z"
],
"new_words": 330,
"words_total": 1791
},
"lesson_13": {
"new_letter": "c",
"old_letters": [
"a",
"b",
"d",
"e",
"f",
"g",
"k",
"l",
"m",
"p",
"s",
"t",
"w",
"z"
],
"new_words": 171,
"words_total": 1962
},
"lesson_14": {
"new_letter": "h",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"k",
"l",
"m",
"p",
"s",
"t",
"w",
"z"
],
"new_words": 669,
"words_total": 2631
},
"lesson_15": {
"new_letter": "u",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"k",
"l",
"m",
"p",
"s",
"t",
"w",
"z"
],
"new_words": 1545,
"words_total": 4176
},
"lesson_16": {
"new_letter": "j",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"k",
"l",
"m",
"p",
"s",
"t",
"u",
"w",
"z"
],
"new_words": 121,
"words_total": 4297
},
"lesson_17": {
"new_letter": "y",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"p",
"s",
"t",
"u",
"w",
"z"
],
"new_words": 136,
"words_total": 4433
},
"lesson_18": {
"new_letter": "o",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"p",
"s",
"t",
"u",
"w",
"y",
"z"
],
"new_words": 1642,
"words_total": 6075
},
"lesson_19": {
"new_letter": "x",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"o",
"p",
"s",
"t",
"u",
"w",
"y",
"z"
],
"new_words": 122,
"words_total": 6197
},
"lesson_20": {
"new_letter": "v",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"o",
"p",
"s",
"t",
"u",
"w",
"x",
"y",
"z"
],
"new_words": 159,
"words_total": 6356
},
"lesson_21": {
"new_letter": "i",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"o",
"p",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
],
"new_words": 2635,
"words_total": 8991
},
"lesson_22": {
"new_letter": "n",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"o",
"p",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
],
"new_words": 4897,
"words_total": 13888
},
"lesson_23": {
"new_letter": "r",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
],
"new_words": 7248,
"words_total": 21136
},
"lesson_24": {
"new_letter": "q",
"old_letters": [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"
],
"new_words": 110,
"words_total": 21246
}
}
\ No newline at end of file
ppp
passa
aa
app
spa
pass
ps
ass
saps
saps
aas
pps
sap
papa
spass
apps
papp
spas
sass
passas
sas
sass
passas
papas
passa
papp
app
papas
pass
spa
aa
spas
ps
papa
spa
ass
apps
spass
sas
ppp
sap