├── lists
└── Taiwan-high-school-6K-108-edition
│ ├── Code
│ ├── Common
│ │ ├── Common.csproj
│ │ ├── WordData.cs
│ │ ├── WordInformation.cs
│ │ └── ReadMe.md
│ ├── CleanData
│ │ ├── CleanData.csproj
│ │ ├── RawDataReader.cs
│ │ ├── RawDataReaderExtensions.cs
│ │ ├── ReadMe.md
│ │ └── Program.cs
│ ├── CompileData
│ │ ├── CompileData.csproj
│ │ ├── WordDataReader.cs
│ │ ├── WordDataReaderExtensions.cs
│ │ ├── ReadMe.md
│ │ └── Program.cs
│ ├── Code.sln
│ └── ReadMe.md
│ ├── Data
│ ├── Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf
│ ├── sha512sums.txt
│ └── Taiwan-College-Entrance-Examination-Center-e-newsletter-issue-213.md
│ └── ReadMe.md
├── notes
├── 2020-08-23-validate-verify.md
├── 2020-11-27-cognitive-load.md
├── 2020-11-16-Taiwan-high-school-6K-108-edition.md
├── 2020-07-17-ASCII-Unicode.md
├── 2018-12-30-commenting.md
├── 2020-10-02-naming.md
├── 2020-08-14-check-test-verify-validate.md
├── 2020-11-07-LeetCode-naming.md
├── 2020-09-25-slice-split.md
├── 2020-09-11-size.md
├── 2020-09-18-attribute-property.md
├── 2020-08-28-copy-clone-duplicate.md
├── 2020-07-24-type-kind-category.md
├── 2020-08-07-times.md
├── 2020-09-04-state-status.md
├── 2020-07-10-count-number-quantity.md
├── 2020-07-31-clear-empty-delete-remove.md
└── 2020-08-21-validate-verify.md
└── ReadMe.md
/lists/Taiwan-high-school-6K-108-edition/Code/Common/Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | enable
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EngTW/English-for-Programmers/HEAD/lists/Taiwan-high-school-6K-108-edition/Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CleanData/CleanData.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Exe
9 | net5.0
10 | enable
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CompileData/CompileData.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Exe
9 | net5.0
10 | enable
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Data/sha512sums.txt:
--------------------------------------------------------------------------------
1 | be5c40e3de75ead6ad95f56b023ed74f491c853f8af364d29e33703d4dc9e9b5234467bdde2f4408be1896c108767437024bcd346b7a6c6021e84565a98e5e0b Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf
2 | 2c0438cadcb61f98c94ec3fc57ceeafa2d9c37f54d69e511839cad3ccbf23fe978cf4f6a4685c2fb1cdddaecd58b2c344d81d7b6a98eef82b82011affdb2d6bf Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf.txt
3 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/Common/WordData.cs:
--------------------------------------------------------------------------------
1 | namespace Common
2 | {
3 | public record WordData
4 | {
5 | public string Word { get; }
6 | public string PartOfSpeech { get; }
7 | public string Level { get; }
8 |
9 | public WordData(string word, string partOfSpeech, string level)
10 | {
11 | Word = word;
12 | PartOfSpeech = partOfSpeech;
13 | Level = level;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/Common/WordInformation.cs:
--------------------------------------------------------------------------------
1 | namespace Common
2 | {
3 | public record WordInformation
4 | {
5 | public string Word { get; }
6 | public string[] PartsOfSpeech { get; }
7 | public string Level { get; }
8 |
9 | public WordInformation(string word, string[] partsOfSpeech, string level)
10 | {
11 | Word = word;
12 | PartsOfSpeech = partsOfSpeech;
13 | Level = level;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/notes/2020-08-23-validate-verify.md:
--------------------------------------------------------------------------------
1 | https://www.facebook.com/twy30/posts/2623363331247315
2 |
3 | # validate vs. verify 🤔
4 |
5 | 應該可以這麼說:
6 |
7 | ---
8 | 如果在你的邏輯模型中,你選擇把以下兩件事分開來看的話
9 |
10 | (a) 此資料是否有效(valid) → 判斷「此資料 是不是 你預期的資料種類(type)? / 此資料值不值得繼續深入檢視它? 」
11 |
12 | (b) 此資料是否滿足「預期的正確條件/狀態」
13 |
14 | 這個時候, *可以* 用 validate 表示 (a) 的意圖;用 verify 表示 (b) 的意圖。
15 |
16 | ---
17 | 例如
18 |
19 | `bool ValidateAge(string age)`; 傳入 "-3", "foo" 會傳回 false; 傳入 20 會傳回 true
20 |
21 | `bool VerifyAge(decimal age)`; 在這個系統中,可能是要確認「成年才能買此商品」,而「成年」在不同地區有不同規定,此 `VerifyAge()` 就會處理「依不同地區的規定去判定此 age 是否成年」這件事。
22 |
23 | ---
24 | 相對的,如果在你的邏輯模型中,你選擇把「資料的有效性(validity)視為『預期的正確條件/狀態』的一部分」的話,那麼,
25 |
26 | 用 validate 或 verify 都說得通。
27 |
28 | ---
29 | 最後,永遠都可以退一步用 "check" 😅
30 |
31 | 我相信大多數人都能知道 "check" 的意圖就是「檢查此資料是否符合作者的邏輯模型的條件」 🤔
32 |
33 | ---
34 | * https://www.ptt.cc/bbs/Soft_Job/M.1597982849.A.9A7.html 如何命名「檢查」功能2
35 | * https://www.ptt.cc/bbs/Soft_Job/M.1597382427.A.19A.html 如何命名「檢查」功能
36 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CompileData/WordDataReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text.Json;
5 | using Common;
6 |
7 | namespace CompileData
8 | {
9 | class WordDataReader
10 | {
11 | IEnumerator wordDataEnumerator;
12 |
13 | public WordDataReader(string inputFilePath)
14 | {
15 | var json = File.ReadAllText(inputFilePath);
16 | var wordDataArray = JsonSerializer.Deserialize(json)!;
17 | Array.Sort(
18 | wordDataArray,
19 | (wordData1, wordData2) => wordData1.ToString().CompareTo(wordData2.ToString()));
20 | wordDataEnumerator = ((IEnumerable)wordDataArray).GetEnumerator();
21 |
22 | wordDataEnumerator.MoveNext();
23 | }
24 |
25 | public WordData ReadWordData()
26 | {
27 | var wordData = wordDataEnumerator.Current;
28 | wordDataEnumerator.MoveNext();
29 | return wordData;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CleanData/RawDataReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace CleanData
6 | {
7 | class RawDataReader
8 | {
9 | IEnumerator lineEnumerator;
10 |
11 | public RawDataReader(string filePath)
12 | {
13 | var lines = File.ReadLines(filePath);
14 | lineEnumerator = lines.GetEnumerator();
15 |
16 | lineEnumerator.MoveNext();
17 | }
18 |
19 | public void SkipLineWhile(Func predicate)
20 | {
21 | while (predicate(lineEnumerator.Current))
22 | {
23 | lineEnumerator.MoveNext();
24 | }
25 | }
26 |
27 | public void SkipLine() => lineEnumerator.MoveNext();
28 |
29 | public string ReadLine()
30 | {
31 | var line = lineEnumerator.Current;
32 | lineEnumerator.MoveNext();
33 | return line;
34 | }
35 |
36 | public IEnumerable ReadLine(int count)
37 | {
38 | while (count > 0)
39 | {
40 | yield return ReadLine();
41 |
42 | --count;
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CleanData/RawDataReaderExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text;
3 | using Common;
4 |
5 | namespace CleanData
6 | {
7 | static class RawDataReaderExtensions
8 | {
9 | public static IEnumerable ReadWordData(this RawDataReader reader, int count)
10 | {
11 | while (count > 0)
12 | {
13 | // Given this particular set of input data, among
14 | // capacity values from 1 to 31, benchmarking found 21
15 | // optimal for computation time.
16 | //
17 | // In comparison, a default capacity of 21 is about 7%
18 | // and 13.5% more efficient than 16 (StringBuilder's
19 | // default capacity) and 31 (input data's max length),
20 | // respectively.
21 | //
22 | // However, the actual impact is a neglectable, 0.1
23 | // millisecond difference on Intel Core i7-6700.
24 | const int optimalCapacity = 21;
25 |
26 | var line = new StringBuilder(reader.ReadLine(), optimalCapacity);
27 | while (!char.IsDigit(line[line.Length - 1]))
28 | {
29 | line.Append(Program.Delimiter);
30 | line.Append(reader.ReadLine());
31 | }
32 |
33 | var tokens = line.ToString().Split(Program.Delimiter);
34 | yield return new(tokens[0], tokens[1], tokens[2]);
35 |
36 | --count;
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/notes/2020-11-27-cognitive-load.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][命名] 縮寫、簡寫的優缺點
5 | 時間 Fri Nov 27 15:46:09 2020
6 | ```
7 |
8 | # 縮寫、簡寫的優缺點
9 |
10 | * Google Docs 版: https://bit.ly/2JgaQCL
11 | * GitHub 討論區: https://bit.ly/321ResR
12 |
13 | ---
14 |
15 | 在「刷 LeetCode 練習命名」( https://bit.ly/2GIyLtk )時,我觀察到
16 | LeetCode 提供的程式碼樣板經常使用簡寫與縮寫;例如,以下案例中,用 `nums`
17 | 代表 `numbers`; 用 `J` 代表寶石( jewel );用 `S` 代表石頭( stone )。
18 |
19 | ```C#
20 | // https://leetcode.com/problems/running-sum-of-1d-array/
21 | public int[] RunningSum(int[] nums)
22 | ```
23 |
24 | ```C#
25 | // https://leetcode.com/problems/jewels-and-stones/
26 | public int NumJewelsInStones(string J, string S)
27 | ```
28 |
29 | 在這系列文章的討論中,也有網友提過「用 `qty`, `cnt` 代表 quantity, count 」
30 | 的主張。
31 |
32 | 這讓我很好奇,有沒有什麼方法可以更全面、一致地評量「縮寫、簡寫的優缺點」?
33 |
34 | 我試著從以下角度切入:
35 | 「每個生態圈、社群、團隊、專案多半會有約定成俗的命名風格」;例如,
36 |
37 | * 遊戲業人士可能會用 `hp` 代表耐久力( hit points )。
38 | * 工業界人士可能會用 `hp` 代表馬力( horse power )。
39 |
40 | 這個「約定成俗」的過程可說是「『知覺負載』成本效益取捨」的演化過程。
41 |
42 | ## 知覺負載
43 |
44 | 所謂「知覺負載( cognitive load )」是指「某件事的『難度』」,也就是
45 | 「該件事有多耗腦力(工作記憶資源)」;它從三個層面來分析「難度」:
46 |
47 | * 一件事本質( intrinsic )上有多難。
48 | * 例如,「算 2+2 」與「算微分方程式」的難度不同。
49 | * 外部( extraneous )因素對一件事的難度的影響
50 | * 例如,同樣的知識,對母語是中文的我們來說,「用中文吸收」與
51 | 「用英文吸收」的難度不同。
52 | * 個人將一件事(的原理)真正搞懂(內化)有多難。
53 | * 例如,「知道」與「做到」的難度不同。
54 |
55 | 參考資料: https://en.wikipedia.org/wiki/Cognitive_load
56 |
57 | ## `num`, `qty`, `cnt`
58 |
59 | 從知覺負載的角度來看,「理解 `num`, `qty`, `cnt` 這些符號」本質上並不難,
60 | 但問題是不同生態圈、社群、團隊、專案的人經歷過的「約定成俗/「知覺負載成
61 | 本效益取捨」演化過程」也不同,就像是遊戲業人士、工業界人士對 `hp` 最直覺
62 | (知覺負載成本最低)的聯想也不同。
63 |
64 | 是故,與其論述「縮寫、簡寫的優缺點」,我更傾向去思考「縮寫、簡寫會如何影
65 | 響誰的知覺負載成本效益」。
66 |
67 | 易言之,與其論述「在程式碼中使用縮寫、簡寫」是簡潔( brevity )還是
68 | 隱晦( obscurity ),我會去想「這份程式碼是為了什麼而要給誰看?這些人有
69 | 什麼樣的共同記憶?」,來決定要用什麼樣的語言來溝通。
70 |
71 | ---
72 |
73 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/7 討論
74 | 的網友。
75 |
76 | ```
77 | --
78 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
79 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1606463173.A.5E7.html
80 | ```
81 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/ReadMe.md:
--------------------------------------------------------------------------------
1 | To make the 108 edition of
2 | "Taiwan High School English Reference Vocabulary List"
3 | (《高中英文參考詞彙表》) machine-readable.
4 |
5 | # Overview
6 |
7 | 0. Get .NET SDK with Docker.
8 | * https://hub.docker.com/_/microsoft-dotnet-sdk/
9 | * `mcr.microsoft.com/dotnet/sdk:5.0-buster-slim-amd64`
10 | 1. Get the original PDF file.
11 | * ```Bash
12 | curl -o Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf https://www.ceec.edu.tw/files/file_pool/1/0k213571061045122620/%e9%ab%98%e4%b8%ad%e8%8b%b1%e6%96%87%e5%8f%83%e8%80%83%e8%a9%9e%e5%bd%99%e8%a1%a8%28111%e5%ad%b8%e5%b9%b4%e5%ba%a6%e8%b5%b7%e9%81%a9%e7%94%a8%29.pdf
13 | ```
14 | 2. Make the PDF file easier to process by manually converting it to TXT.
15 | 1. Read data.
16 | 1. Open `Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf`.
17 | 2. CTRL + A (select all text).
18 | 3. CTRL + C (copy).
19 | 2. Write data.
20 | 1. Create `Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf.txt`.
21 | 2. CTRL + V (paste).
22 | 3. Verify file integrity.
23 | * ```Bash
24 | pushd Data
25 | sha512sum --check sha512sums.txt
26 | popd
27 | ```
28 | 4. Clean up the raw data.
29 | * ```Bash
30 | dotnet run --project Code/CleanData -- Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf.txt Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf.json
31 | ```
32 | 5. Compile the word list.
33 | * ```Bash
34 | dotnet run --project Code/CompileData -- Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.pdf.json Data/Taiwan-high-school-english-reference-vocabulary-list-108-edition.json
35 | ```
36 |
37 | ## Taiwan High School English Reference Vocabulary List (《高中英文參考詞彙表》)
38 |
39 | Published by Taiwan College Entrance Examination Center
40 | (大學入學考試中心, https://www.ceec.edu.tw/ ).
41 |
42 | * The 108 edition (《108參考詞彙表》): https://www.ceec.edu.tw/xcepaper/cont?xsmsid=0J066588036013658199&qunit=0J066616104134302815&sid=0K227548677326460907
43 | * The 91 edition (《91參考詞彙表》): https://www.ceec.edu.tw/SourceUse/ce37/ce37.htm
44 |
45 | ### Copyright Notice
46 |
47 | From the original PDF file (cover page):
48 |
49 | > 著作權屬財團法人大學入學考試中心基金會所有,僅供非營利目的使用,轉載請註明出處。若作為營利目的使用,應事前經由財團法人大學入學考試中心基金會書面同意授權。
50 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Data/Taiwan-College-Entrance-Examination-Center-e-newsletter-issue-213.md:
--------------------------------------------------------------------------------
1 | * source: https://www.ceec.edu.tw/xcepaper/cont?xsmsid=0J066588036013658199&qunit=0J066616104134302815&sid=0K227548677326460907
2 |
3 | ---
4 |
5 | 選才電子報
6 |
7 | ---
8 |
9 | * [首頁](http://www.ceec.edu.tw/)
10 | * [選才電子報](https://www.ceec.edu.tw/xcepaper/home?xsmsid=0J066588036013658199)
11 | * [高中英文參考詞彙表(111學年度起適用)編修說明](https://www.ceec.edu.tw/xcepaper/cont?xsmsid=0J066588036013658199&qunit=0J066616104134302815&sid=0K227548677326460907)
12 |
13 | ---
14 |
15 | * 試訊快遞
16 | * 學測
17 | * 109-08-17
18 | * 第312期
19 | * 臺灣師範大學英語系教授/陳浩然、大考中心研究員/游春琪、林秀慧、彭怡寧 撰
20 |
21 | ---
22 |
23 | # 高中英文參考詞彙表(111學年度起適用)編修說明
24 |
25 | 臺灣師範大學英語系教授/陳浩然、大考中心研究員/游春琪、林秀慧、彭怡寧 撰
26 |
27 | 111學年度起,學科能力測驗英文考科(簡稱學測英文)與高中英語聽力測驗(簡稱英聽),即依據108學年度實施之「十二年國民基本教育課程綱要國民中小學暨普通型高級中等學校語文領域—英語文」(簡稱「英語文課綱」)命題。《高中英文參考詞彙表》長期以來做為大學入學考試中心英文科相關測驗的命題參考資料之一,也是高中教學與學生學習的參考內容。
28 |
29 | 現行《高中英文參考詞彙表》(簡稱《91參考詞彙表》或《91年版》)乃是民國89至91年間,由鄭恆雄教授等執行「大考中心高中英文參考詞彙表編修研究計畫」[1]之成果,至今業已使用多年。考量隨時間變遷,許多英語文詞彙近年來逐漸頻繁出現於日常生活中(如:custody, icon, incredible, ongoing, online, portfolio, sensor, terrorism, venue, workout等);且多年來,陸續有高中教師反映91參考詞彙表中部分詞彙目前較為罕用,可考慮做若干的調整。綜合前述各項因素及因應語言使用之變化,重新編修《91參考詞彙表》確有其必要性。
30 |
31 | 本中心於104年,由教育部補助進行「配合課綱調整試題研發以及招考長程規劃—高中英文參考詞彙表編修計畫(104)」[2],以《91參考詞彙表》的6,480詞條(entries)為基礎,完成5,280個單詞之參考詞彙表。107年4月教育部公告「108英語文課綱」後,本中心再進行「高中英文參考詞彙表編修計畫(107)」[3],酌予納入英語文課綱之參考字彙表(2,000字詞),重新編輯成《高中英文參考詞彙表》(簡稱《108參考詞彙表》或《108年版》),仍分為六級,每一級收錄約1,000詞條,六個級別共計約6,000詞條。
32 |
33 | 此更新版之《108參考詞彙表》大致依循了《91參考詞彙表》之編輯原則,舊版詞彙表運用與反應的是當時之語料資料,但隨時空環境變遷至今,語料的蒐集與內容已有發展與改變。本版編纂過程歷經專案研究計畫研發、學科專家座談、大學教授及高中教師問卷調查等程序後最終順利完成。過程中參考了語料庫的字表、專家編輯之字表、字典及其詞頻表、高中教科書與英語分級讀本語料、歷年大學入學考試相關試題等五大類參考資料,作為詞彙篩選參考,我國文化背景、教學層面等多方因素亦同時納入篩選考量,而後據此針對各個詞彙逐一進行檢視。
34 |
35 | 因《108參考詞彙表》多以書寫型詞彙為主,《91參考詞彙表》中所含括之口語型詞彙(如:yummy)遂不予列入,另外,《91年版》列入之部分專有名詞(如:DVD/digital video disk),由於已不再時興;少數之縮寫字(如:km)、片語(如:according to),考量其可於課室中學習,因此以上三類詞彙於《108年版》皆不再列入。不含括於《91年版》之新增詞彙,大部分是挑選自前述五大類參考資料中出現之高詞頻詞彙(如:collaboration, compulsory, database, emission, forum, indigenous, legacy, orientation, scenario, striking等)。另外,計畫案期間召開之座談會中,與會高中教師建議可列入之較常見的宗教名、國家名、數字、月份、季節等,則另外表列於附錄,以提供參考。修訂完成後統計,《108參考詞彙表》保留了約95%的《[91參考詞彙表](https://www.ceec.edu.tw/SourceUse/ce37/ce37.htm)》詞條,而另行新增加詞條約占近5%。
36 |
37 | 本次編修之《[108參考詞彙表](https://www.ceec.edu.tw/files/file_pool/1/0k213571061045122620/%e9%ab%98%e4%b8%ad%e8%8b%b1%e6%96%87%e5%8f%83%e8%80%83%e8%a9%9e%e5%bd%99%e8%a1%a8%28111%e5%ad%b8%e5%b9%b4%e5%ba%a6%e8%b5%b7%e9%81%a9%e7%94%a8%29.pdf)》已於109年7月31日公告於本中心網頁,內容雖已力求確保品質,仍不免有再精進的空間,歡迎各界不吝惠予指正與建議。本詞彙表期望能夠系統性地彙整呈現高中階段學習中最常見的英文詞彙,以便讓學生在日常英語文閱讀、聆聽、口說、寫作能力養成上,都能充分應用這些字詞。
38 |
39 | ---
40 |
41 | [1] 本計畫由臺灣大學外文系鄭恆雄教授主持,研究成員包括政治大學英文系張郇慧教授、臺灣師範大學英語系程玉秀教授、臺北市立第一女子高級中學顧英秀老師(按姓氏筆畫排序)。
42 |
43 | [2] 教育部於104年補助本中心進行「配合課綱調整試題研發以及招考長程規劃—高中英文參考詞彙表編修計畫(104)」,由臺灣師範大學英語系陳浩然教授擔任本計畫主持人,其餘六位成員包括政治大學英文系尤雪瑛教授、臺灣科技大學應外系王世平教授、臺灣大學外文系高照明教授、臺灣師範大學英語系程玉秀教授、本中心英文科學科研究員林秀慧及游春琪(按姓氏筆畫排序)。
44 |
45 | [3] 本計畫由臺灣師範大學英語系陳浩然教授主持,研究成員為大考中心英文科學科研究員林秀慧、彭怡寧、游春琪(按姓氏筆畫排序)。
46 |
--------------------------------------------------------------------------------
/notes/2020-11-16-Taiwan-high-school-6K-108-edition.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 高中6K字-108版
5 | 時間 Tue Nov 17 08:03:03 2020
6 | ```
7 |
8 | # 高中6K字-108版
9 |
10 | 大學入學考試中心「選才電子報」第 312 期( 2020-08-17 )談論了新版的
11 | 《高中英文參考詞彙表》,內有單字、詞性、級別,並提供 PDF 版下載;我把它
12 | 清理了一下,整理出 JSON 版及 Google Sheets 版,方便應用。
13 |
14 | * Google Sheets 版: https://bit.ly/2ULo0tL
15 | * JSON 版: https://bit.ly/2ILggFo
16 | * JSON schema 可參考程式碼 https://bit.ly/3kwIVek 裡的
17 | `Common/WordInformation.cs` 。
18 |
19 | ---
20 |
21 | * 這篇文的 Google Docs 版: https://bit.ly/35C8AhB
22 | * GitHub 討論區 https://bit.ly/321ResR
23 |
24 | ## 大學入學考試中心的版權聲明
25 |
26 | 來自大學入學考試中心釋出的 PDF 檔的首頁:
27 |
28 | > 著作權屬財團法人大學入學考試中心基金會所有,僅供非營利目的使用,轉載請
29 | > 註明出處。若作為營利目的使用,應事前經由財團法人大學入學考試中心基金會
30 | > 書面同意授權。
31 |
32 | ## 來源連結
33 |
34 | * 大學入學考試中心「選才電子報」第 312 期( 2020-08-17 ): https://www.ceec.edu.tw/xcepaper/cont?xsmsid=0J066588036013658199&qunit=0J066616104134302815&sid=0K227548677326460907
35 |
36 | * 《高中英文參考詞彙表》 PDF 原檔: https://www.ceec.edu.tw/files/file_pool/1/0k213571061045122620/%e9%ab%98%e4%b8%ad%e8%8b%b1%e6%96%87%e5%8f%83%e8%80%83%e8%a9%9e%e5%bd%99%e8%a1%a8%28111%e5%ad%b8%e5%b9%b4%e5%ba%a6%e8%b5%b7%e9%81%a9%e7%94%a8%29.pdf
37 |
38 | ## 編輯方針
39 |
40 | * PDF 原檔列出了 6012 條項目,是以字義為主;例如,
41 | * railroad, railway (鐵路)是同一個項目。
42 | * medium 當形容詞(中等)時是一個項目,當名詞(媒介)時是另一個項目。
43 | * 我整理的版本以拼字為主,有 6170 條項目;例如,
44 | * railroad, railway 算兩個項目。
45 | * medium 的形容詞、名詞算同一個項目。
46 |
47 | ---
48 |
49 | * PDF 原檔最後附錄有列出一些名詞;例如,
50 | * 基數、序數、詞性
51 | * 日、月、季
52 | * 國家、大陸、海洋、宗教
53 | * 我整理的版本不包含該附錄
54 |
55 | # 程式英文
56 |
57 | 我寫了個小程式( https://bit.ly/3kwIVek )來整理這個字表;若只計算我宣告
58 | 的型別、方法、變數(不算程式語言關鍵字、內建框架/函式庫用字),這個小程
59 | 式一共用了約 32 個英文單字,其中 27 (84%) 個有包含在此
60 | 《高中英文參考詞彙表》字表內。
61 |
62 | 剩下 5 個單字是:
63 |
64 | * delimiter
65 | * enumerator
66 | * JSON
67 | * optimal
68 | * predicate
69 |
70 | ---
71 |
72 | 我使用的命名大致上都是以 2, 3 個單字組成的堆疊字。
73 |
74 | 比較明顯的例外有:
75 |
76 | * knownWordDataCount // 已知 WordData 數量
77 | * knownWordInfoCount // 已知 WordInfo 數量
78 | * RawDataReaderExtensions // 原始 資料 讀取器 延伸物(複數)
79 | * WordDataReaderExtensions // 單字 資料 讀取器 延伸物(複數)
80 | * 以及 `CompileData/WordDataReaderExtensions.cs` 裡的方法名稱。
81 |
82 | 有興趣的話,可以 code review 一下這份程式碼,看看在型別、方法、變數命名
83 | 上是否「好懂」。
84 |
85 | 有任何想法、疑問,都歡迎提出來討論 :)
86 |
87 | ```
88 | --
89 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
90 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1605571388.A.0D0.html
91 | 推 Csongs: 可以貼高中板,會有比較多使用心得(?) 11/17 08:27
92 |
93 | 請問,「高中板」是指 SENIORHIGH 板嗎? :)
94 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/17/2020 08:43:43
95 | → Csongs: 對喔 ,他們應該要學測了XD 11/17 08:44
96 |
97 | 了解,謝謝你的建議。 :)
98 |
99 | 我去跟該板板務確認一下這篇文的東西適不適合貼過去。
100 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/17/2020 09:26:22
101 |
102 | 已轉發至 https://www.ptt.cc/bbs/SENIORHIGH/M.1605645461.A.35C.html 。
103 |
104 | 再次感謝你的建議 :)
105 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/18/2020 04:47:23
106 | 推 jack42107: 推用心 11/21 01:34
107 |
108 | 謝謝 :)
109 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/27/2020 15:43:53
110 | ```
111 |
--------------------------------------------------------------------------------
/notes/2020-07-17-ASCII-Unicode.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 一定要寫英文嗎?
5 | 時間 Fri Jul 17 16:56:57 2020
6 | ```
7 |
8 | 上次談了《如何命名「數量變數」?》,收到很多迴響,其中一個最常見的問題是
9 | :「寫程式一定要用英文嗎?」今天就來談談這個題目。
10 |
11 | * Google 簡報: https://bit.ly/32rtGy3
12 | * Google 簡報原始檔: https://bit.ly/2DGDhXd
13 | * Facebook 相簿: https://bit.ly/3fCF2mv
14 |
15 | * GitHub 討論區: https://bit.ly/321ResR
16 | * Twitter 討論串: https://bit.ly/2ZGtY2l
17 |
18 | ---
19 | # 寫程式一定要用英文嗎?
20 |
21 | 有的時候,因為既有的產業行規、社群文化、團隊決策、技術限制,我們沒有選擇
22 | ;也就是所謂「人在江湖,身不由己」。
23 |
24 | 這裡討論的是「可以自己選擇」的情況,從以下兩個層面來思考。
25 |
26 | * 技術
27 | * 價值
28 |
29 | ---
30 | # 技術
31 |
32 | ## 推薦「美式英文 + ASCII 字集」
33 |
34 | 因為歷史因素,英文是電腦科學的通用語,累積了極大的智慧資產,是故,以「相
35 | 容性」為考量,
36 |
37 | * 在程式碼層級,使用 ASCII 字碼來命名變數、方法、類別、等等。
38 | * 在使用各種工具時,使用 ASCII 字碼命名檔案、參數
39 | * 現代鍵盤與字型罕有不支援 ASCII 字碼的。
40 |
41 | 「美式英文 + ASCII 字集」是個「低成本、高效益」的選擇。
42 |
43 | ## 案例討論
44 |
45 | * 美式英文 與 英式英文 有些微拼字差異,例如
46 |
47 | * Color / Colour
48 | * Center / Centre
49 | * Serialize / Serialise
50 |
51 | 當前函式庫、工具鏈,大多以美式英文為主。
52 |
53 | * UNICODE 有它的好處,但也有它麻煩的地方,
54 |
55 | (PTT 對 Unicode 的支援不完整,請到 Google 簡報原始檔看這段:
56 | https://bit.ly/2DGDhXd )
57 |
58 | 例如
59 |
60 | * U+03B1 / U+237A 看起來很相似
61 |
62 | * U+00C1 / U+0041 U+0301 顯示出來是同一個字,但是是不一樣的字元
63 |
64 | * 有些語言需要用到完整的拉丁字集才能精準表達意思。
65 |
66 | 後面會討論「在程式碼中使用 Unicode 」的案例。
67 |
68 | ---
69 | # 價值
70 |
71 | 程式作品的價值主要來自於「滿足需求,解決問題」,而不是「寫程式時用英文」
72 | 。
73 |
74 | 這 *不是* 在否定「寫程式時用英文 / 與世界潮流接軌 / 讓維護程式的人好做事
75 | 」這件事。
76 |
77 | 若能把英文學好,能流利地寫 commit 訊息、寫註解、寫文件、與洋鄉民交流、開
78 | 拓職涯,當然是好事。
79 |
80 | 這裡我們思考的是「成本與效益的平衡」,也就是說,如果目前英文還沒有那麼好
81 | ,怎麼辦?
82 |
83 | 也就是「寫程式一定要用英文嗎?」
84 |
85 | 我的主張是:
86 |
87 | * 「滿足需求,解決問題」 > 「寫程式時用英文」
88 | * 「正確 + 清楚 + 簡潔的資訊」 > 「模糊的資訊」
89 | * 「正確 + 清楚 + 簡潔的非英文資訊」 > 「模糊的英文資訊」
90 |
91 | 也就是說,當你的程式作品先創造了價值,之後才會有人來想了解它。(也有可能
92 | 是兩週後的你自己回來看這程式 XD )。
93 |
94 | 而「正確 + 清楚 + 簡潔的非英文資訊」會比「模糊的英文資訊」對它更有幫助。
95 |
96 | 它可以用機器翻譯「正確 + 清楚 + 簡潔的非英文資訊」,它可以找朋友翻譯。
97 |
98 | 但如果是「模糊的英文資訊」,那它就只能去通靈擲笅了。
99 |
100 | ## 錯誤訊息 > 文件 > 註解
101 |
102 | 撰寫「正確 + 清楚 + 簡潔的 (英文 / 非英文) 資訊」 也需要成本,我會依以下
103 | 順序來投資:
104 |
105 | 1. 錯誤訊息
106 | 2. 文件
107 | 3. 程式碼註解
108 |
109 | 我的想法是,「想用工具解決問題的人」會比「想了解工具構造的人」多。
110 |
111 | 或著說,在一個人對某工具的構造有興趣前,它要先覺得這工具很好用。
112 |
113 | 是故,我會先投資在程式的「錯誤訊息、警告、參數資訊」上,先幫助使用者解決
114 | 它的問題。
115 |
116 | 這些資訊、訊息通常也較短,不管是寫母語還是寫英文,比較容易做到「正確 +
117 | 清楚 + 簡潔」。
118 |
119 | ## 文化、產業、地區特有術語
120 |
121 | 與其硬翻而失真(最後從母語、英文兩邊都看不懂),可以考慮音譯、直譯,並加
122 | 上註解。
123 |
124 | ---
125 | # Unicode
126 |
127 | (PTT 對 Unicode 的支援不完整,請到 Google 簡報原始檔看這段:
128 | https://bit.ly/2DGDhXd )
129 |
130 | ASCII 是 1960 年代的東西,就方法、類別命名來說,還是推薦
131 | 「美式英文 + ASCII 字集」;但就小塊的程式碼而言,若適當使用 Unicode, 或
132 | 許可以增進程式碼的可讀性。
133 |
134 | ## Emoji
135 |
136 | 能這麼做,不代表該這麼做 XD
137 |
138 | ## 希臘字母 / subscript / superscript
139 |
140 | 數學、科學計算式常用到希臘字母、 subscript, superscript 。
141 |
142 | 相對於
143 |
144 | * pi
145 | * deltaT
146 | * F_0
147 | * F_n_1
148 |
149 | 這樣的傳統 ASCII 寫法, Unicode 提供了另一種可能性。
150 |
151 | ---
152 | # 寫程式一定要用英文嗎?
153 |
154 | 就長遠來說,能多學、多練習、加強英文能力當然是好事。
155 |
156 | 但在英文能力還不到位時,為了滿足眼前的需求,不管是台式英文、漢語拼音、日
157 | 文拼音、用中文寫 commit 訊息、寫文件、寫註解,都是成本與效益的取捨。
158 |
159 | 希望這篇文有提供讀者一些思考的方向,來檢視每個人自己的取捨選擇策略。
160 |
161 | 有任何程式設計、軟體工程相關的英文問題,都很歡迎到《程式英文》 GitHub 討
162 | 論區 https://bit.ly/321ResR 留言;這可以幫助我把這知識庫整理得更完善。
163 |
164 | 謝謝 :)
165 |
166 | ```
167 | --
168 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
169 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1594976222.A.175.html
170 | 推 alihue: 推推 07/17 18:27
171 | 推 tw11509: 推推 07/17 18:41
172 | 推 bill0205: push 07/17 19:15
173 | 推 CaptPlanet: U質 07/17 23:18
174 | 推 lazyfirst: 推推 07/18 08:13
175 | 推 jobintan: Nice, dude. 07/18 10:36
176 |
177 | 謝謝 :)
178 |
179 | 接下來我打算整理這個題目:
180 |
181 | * 「種類(type, kind, sort, class, category, classification)」該用哪個字?
182 | * https://github.com/EngTW/English-for-Programmers/issues/13
183 |
184 | 如果有任何感想、問題、建議,請讓我知道 :)
185 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/18/2020 13:04:30
186 | ```
187 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/Code.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26124.0
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{D2673410-0191-4EB0-9C2C-9D9E3F7F777A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CleanData", "CleanData\CleanData.csproj", "{4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompileData", "CompileData\CompileData.csproj", "{FA250F00-D44F-47F3-87D4-7DD5CF28645C}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|x64 = Debug|x64
16 | Debug|x86 = Debug|x86
17 | Release|Any CPU = Release|Any CPU
18 | Release|x64 = Release|x64
19 | Release|x86 = Release|x86
20 | EndGlobalSection
21 | GlobalSection(SolutionProperties) = preSolution
22 | HideSolutionNode = FALSE
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|x64.ActiveCfg = Debug|Any CPU
28 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|x64.Build.0 = Debug|Any CPU
29 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|x86.ActiveCfg = Debug|Any CPU
30 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Debug|x86.Build.0 = Debug|Any CPU
31 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|Any CPU.Build.0 = Release|Any CPU
33 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|x64.ActiveCfg = Release|Any CPU
34 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|x64.Build.0 = Release|Any CPU
35 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|x86.ActiveCfg = Release|Any CPU
36 | {D2673410-0191-4EB0-9C2C-9D9E3F7F777A}.Release|x86.Build.0 = Release|Any CPU
37 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|x64.ActiveCfg = Debug|Any CPU
40 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|x64.Build.0 = Debug|Any CPU
41 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|x86.ActiveCfg = Debug|Any CPU
42 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Debug|x86.Build.0 = Debug|Any CPU
43 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|Any CPU.Build.0 = Release|Any CPU
45 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|x64.ActiveCfg = Release|Any CPU
46 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|x64.Build.0 = Release|Any CPU
47 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|x86.ActiveCfg = Release|Any CPU
48 | {4C4D57F4-28C1-45A0-9F68-458AC9B33B1D}.Release|x86.Build.0 = Release|Any CPU
49 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|Any CPU.Build.0 = Debug|Any CPU
51 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|x64.ActiveCfg = Debug|Any CPU
52 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|x64.Build.0 = Debug|Any CPU
53 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|x86.ActiveCfg = Debug|Any CPU
54 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Debug|x86.Build.0 = Debug|Any CPU
55 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|Any CPU.ActiveCfg = Release|Any CPU
56 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|Any CPU.Build.0 = Release|Any CPU
57 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|x64.ActiveCfg = Release|Any CPU
58 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|x64.Build.0 = Release|Any CPU
59 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|x86.ActiveCfg = Release|Any CPU
60 | {FA250F00-D44F-47F3-87D4-7DD5CF28645C}.Release|x86.Build.0 = Release|Any CPU
61 | EndGlobalSection
62 | EndGlobal
63 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CompileData/WordDataReaderExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Common;
5 |
6 | namespace CompileData
7 | {
8 | static class WordDataReaderExtensions
9 | {
10 | public static IEnumerable ReadWordInformation_SingleWord_MultiPartsOfSpeech(this WordDataReader reader, int count)
11 | {
12 | // WordData \{ Word = \w+, PartOfSpeech = \w+\.(/\w+\.)*, Level = \d \}
13 |
14 | while (count > 0)
15 | {
16 | var wordData = reader.ReadWordData();
17 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Program.Delimiters);
18 | yield return new(wordData.Word, partOfSpeechTokens, wordData.Level);
19 |
20 | --count;
21 | }
22 | }
23 |
24 | public static IEnumerable ReadWordInformation_MultiWords_SinglePartOfSpeech(this WordDataReader reader)
25 | {
26 | // WordData \{ Word = [^/]+(/[^/]+)+, PartOfSpeech = \w+\., Level = \d \}
27 |
28 | var wordData = reader.ReadWordData();
29 | var wordTokens = wordData.Word.Split(Program.Delimiters);
30 | return wordTokens.Select(
31 | wordToken =>
32 | new WordInformation(wordToken, new[] { wordData.PartOfSpeech }, wordData.Level));
33 | }
34 |
35 | public static WordInformation ReadWordInformation_PluralNoun(this WordDataReader reader)
36 | {
37 | // WordData \{ Word = \w+\(s\), PartOfSpeech = \w+\.(/\w+\.)*, Level = \d \}
38 |
39 | var wordData = reader.ReadWordData();
40 | var wordTokens = wordData.Word.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
41 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
42 | return new(wordTokens[0], partOfSpeechTokens, wordData.Level);
43 | }
44 |
45 | public static IEnumerable ReadWordInformation_Verb_Noun(this WordDataReader reader)
46 | {
47 | // WordData \{ Word = \w+\(ment\), PartOfSpeech = v\./\(n\.\), Level = \d \}
48 |
49 | var wordData = reader.ReadWordData();
50 | var wordTokens = wordData.Word.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
51 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
52 | return new WordInformation[] {
53 | new(wordTokens[0], new[] { partOfSpeechTokens[0] }, wordData.Level),
54 | new(wordTokens[0] + wordTokens[1], new[] { partOfSpeechTokens[1] }, wordData.Level) };
55 | }
56 |
57 | public static IEnumerable ReadWordInformation_Pronoun(this WordDataReader reader)
58 | {
59 | // WordData \{ Word = \w+ \(\w+(, \w+)*\), PartOfSpeech = pron\., Level = \d \}
60 |
61 | var wordData = reader.ReadWordData();
62 | var wordTokens = wordData.Word.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
63 | return wordTokens.Select(
64 | wordToken =>
65 | new WordInformation(wordToken, new[] { wordData.PartOfSpeech }, wordData.Level));
66 | }
67 |
68 | public static IEnumerable ReadWordInformation_MultiWords_MultiPartsOfSpeech(this WordDataReader reader)
69 | {
70 | // WordData \{ Word = [^/]+(/[^/]+)+, PartOfSpeech = \w+\.(/\w+\.)+, Level = \d \}
71 |
72 | var wordData = reader.ReadWordData();
73 | var wordTokens = wordData.Word.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
74 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Program.Delimiters, StringSplitOptions.RemoveEmptyEntries);
75 | return wordTokens.Select(
76 | wordToken =>
77 | new WordInformation(wordToken, partOfSpeechTokens, wordData.Level));
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Solution Creation Log
2 |
3 | ```
4 | $ date
5 | Sat Nov 14 02:11:13 UTC 2020
6 | $ dotnet --version
7 | 5.0.100
8 | $ # List installed templates.
9 | $ dotnet new --uninstall
10 | Template Instantiation Commands for .NET Core CLI
11 |
12 | Currently installed items:
13 | NUnit3.DotNetNew.Template
14 | Details:
15 | NuGetPackageId: NUnit3.DotNetNew.Template
16 | Version: 1.8.1
17 | Author: akharlov
18 | Templates:
19 | NUnit 3 Test Project (nunit) C#
20 | NUnit 3 Test Item (nunit-test) C#
21 | NUnit 3 Test Project (nunit) F#
22 | NUnit 3 Test Item (nunit-test) F#
23 | NUnit 3 Test Project (nunit) VB
24 | NUnit 3 Test Item (nunit-test) VB
25 | Uninstall Command:
26 | dotnet new -u NUnit3.DotNetNew.Template
27 |
28 | Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
29 | Details:
30 | NuGetPackageId: Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
31 | Version: 5.0.0
32 | Author: Microsoft
33 | Templates:
34 | ASP.NET Core with Angular (angular) C#
35 | ASP.NET Core with React.js (react) C#
36 | ASP.NET Core with React.js and Redux (reactredux) C#
37 | Uninstall Command:
38 | dotnet new -u Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
39 |
40 | Microsoft.DotNet.Test.ProjectTemplates.5.0
41 | Details:
42 | NuGetPackageId: Microsoft.DotNet.Test.ProjectTemplates.5.0
43 | Version: 1.0.2-beta4.20420.1
44 | Author: Microsoft
45 | Templates:
46 | Unit Test Project (mstest) C#
47 | Unit Test Project (mstest) F#
48 | Unit Test Project (mstest) VB
49 | xUnit Test Project (xunit) C#
50 | xUnit Test Project (xunit) F#
51 | xUnit Test Project (xunit) VB
52 | Uninstall Command:
53 | dotnet new -u Microsoft.DotNet.Test.ProjectTemplates.5.0
54 |
55 | Microsoft.DotNet.Web.ItemTemplates
56 | Details:
57 | NuGetPackageId: Microsoft.DotNet.Web.ItemTemplates
58 | Version: 5.0.0
59 | Author: Microsoft
60 | Templates:
61 | Protocol Buffer File (proto)
62 | Razor Component (razorcomponent) C#
63 | Razor Page (page) C#
64 | MVC ViewImports (viewimports) C#
65 | MVC ViewStart (viewstart) C#
66 | Uninstall Command:
67 | dotnet new -u Microsoft.DotNet.Web.ItemTemplates
68 |
69 | Microsoft.DotNet.Web.ProjectTemplates.5.0
70 | Details:
71 | NuGetPackageId: Microsoft.DotNet.Web.ProjectTemplates.5.0
72 | Version: 5.0.0
73 | Author: Microsoft
74 | Templates:
75 | Blazor Server App (blazorserver) C#
76 | Blazor WebAssembly App (blazorwasm) C#
77 | ASP.NET Core Empty (web) C#
78 | ASP.NET Core Empty (web) F#
79 | ASP.NET Core gRPC Service (grpc) C#
80 | Razor Class Library (razorclasslib) C#
81 | ASP.NET Core Web App (webapp) C#
82 | ASP.NET Core Web App (Model-View-Controller) (mvc) C#
83 | ASP.NET Core Web App (Model-View-Controller) (mvc) F#
84 | ASP.NET Core Web API (webapi) C#
85 | ASP.NET Core Web API (webapi) F#
86 | Worker Service (worker) C#
87 | Worker Service (worker) F#
88 | Uninstall Command:
89 | dotnet new -u Microsoft.DotNet.Web.ProjectTemplates.5.0
90 |
91 | Microsoft.DotNet.Common.ProjectTemplates.5.0
92 | Details:
93 | NuGetPackageId: Microsoft.DotNet.Common.ProjectTemplates.5.0
94 | Version: 5.0.0
95 | Author: Microsoft
96 | Templates:
97 | Class library (classlib) C#
98 | Class library (classlib) F#
99 | Class library (classlib) VB
100 | Console Application (console) C#
101 | Console Application (console) F#
102 | Console Application (console) VB
103 | Uninstall Command:
104 | dotnet new -u Microsoft.DotNet.Common.ProjectTemplates.5.0
105 |
106 | Microsoft.DotNet.Common.ItemTemplates
107 | Details:
108 | NuGetPackageId: Microsoft.DotNet.Common.ItemTemplates
109 | Version: 5.0.0
110 | Author: Microsoft
111 | Templates:
112 | dotnet gitignore file (gitignore)
113 | global.json file (globaljson)
114 | NuGet Config (nugetconfig)
115 | Solution File (sln)
116 | Dotnet local tool manifest file (tool-manifest)
117 | Web Config (webconfig)
118 | Uninstall Command:
119 | dotnet new -u Microsoft.DotNet.Common.ItemTemplates
120 |
121 | $ basename $(pwd)
122 | Code
123 | $ dotnet new sln
124 | The template "Solution File" was created successfully.
125 | ```
126 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/Common/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Project Creation Log
2 |
3 | ```
4 | $ date
5 | Sat Nov 14 01:46:53 UTC 2020
6 | $ dotnet --version
7 | 5.0.100
8 | $ # List installed templates.
9 | $ dotnet new --uninstall
10 | Template Instantiation Commands for .NET Core CLI
11 |
12 | Currently installed items:
13 | NUnit3.DotNetNew.Template
14 | Details:
15 | NuGetPackageId: NUnit3.DotNetNew.Template
16 | Version: 1.8.1
17 | Author: akharlov
18 | Templates:
19 | NUnit 3 Test Project (nunit) C#
20 | NUnit 3 Test Item (nunit-test) C#
21 | NUnit 3 Test Project (nunit) F#
22 | NUnit 3 Test Item (nunit-test) F#
23 | NUnit 3 Test Project (nunit) VB
24 | NUnit 3 Test Item (nunit-test) VB
25 | Uninstall Command:
26 | dotnet new -u NUnit3.DotNetNew.Template
27 |
28 | Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
29 | Details:
30 | NuGetPackageId: Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
31 | Version: 5.0.0
32 | Author: Microsoft
33 | Templates:
34 | ASP.NET Core with Angular (angular) C#
35 | ASP.NET Core with React.js (react) C#
36 | ASP.NET Core with React.js and Redux (reactredux) C#
37 | Uninstall Command:
38 | dotnet new -u Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
39 |
40 | Microsoft.DotNet.Test.ProjectTemplates.5.0
41 | Details:
42 | NuGetPackageId: Microsoft.DotNet.Test.ProjectTemplates.5.0
43 | Version: 1.0.2-beta4.20420.1
44 | Author: Microsoft
45 | Templates:
46 | Unit Test Project (mstest) C#
47 | Unit Test Project (mstest) F#
48 | Unit Test Project (mstest) VB
49 | xUnit Test Project (xunit) C#
50 | xUnit Test Project (xunit) F#
51 | xUnit Test Project (xunit) VB
52 | Uninstall Command:
53 | dotnet new -u Microsoft.DotNet.Test.ProjectTemplates.5.0
54 |
55 | Microsoft.DotNet.Web.ItemTemplates
56 | Details:
57 | NuGetPackageId: Microsoft.DotNet.Web.ItemTemplates
58 | Version: 5.0.0
59 | Author: Microsoft
60 | Templates:
61 | Protocol Buffer File (proto)
62 | Razor Component (razorcomponent) C#
63 | Razor Page (page) C#
64 | MVC ViewImports (viewimports) C#
65 | MVC ViewStart (viewstart) C#
66 | Uninstall Command:
67 | dotnet new -u Microsoft.DotNet.Web.ItemTemplates
68 |
69 | Microsoft.DotNet.Web.ProjectTemplates.5.0
70 | Details:
71 | NuGetPackageId: Microsoft.DotNet.Web.ProjectTemplates.5.0
72 | Version: 5.0.0
73 | Author: Microsoft
74 | Templates:
75 | Blazor Server App (blazorserver) C#
76 | Blazor WebAssembly App (blazorwasm) C#
77 | ASP.NET Core Empty (web) C#
78 | ASP.NET Core Empty (web) F#
79 | ASP.NET Core gRPC Service (grpc) C#
80 | Razor Class Library (razorclasslib) C#
81 | ASP.NET Core Web App (webapp) C#
82 | ASP.NET Core Web App (Model-View-Controller) (mvc) C#
83 | ASP.NET Core Web App (Model-View-Controller) (mvc) F#
84 | ASP.NET Core Web API (webapi) C#
85 | ASP.NET Core Web API (webapi) F#
86 | Worker Service (worker) C#
87 | Worker Service (worker) F#
88 | Uninstall Command:
89 | dotnet new -u Microsoft.DotNet.Web.ProjectTemplates.5.0
90 |
91 | Microsoft.DotNet.Common.ProjectTemplates.5.0
92 | Details:
93 | NuGetPackageId: Microsoft.DotNet.Common.ProjectTemplates.5.0
94 | Version: 5.0.0
95 | Author: Microsoft
96 | Templates:
97 | Class library (classlib) C#
98 | Class library (classlib) F#
99 | Class library (classlib) VB
100 | Console Application (console) C#
101 | Console Application (console) F#
102 | Console Application (console) VB
103 | Uninstall Command:
104 | dotnet new -u Microsoft.DotNet.Common.ProjectTemplates.5.0
105 |
106 | Microsoft.DotNet.Common.ItemTemplates
107 | Details:
108 | NuGetPackageId: Microsoft.DotNet.Common.ItemTemplates
109 | Version: 5.0.0
110 | Author: Microsoft
111 | Templates:
112 | dotnet gitignore file (gitignore)
113 | global.json file (globaljson)
114 | NuGet Config (nugetconfig)
115 | Solution File (sln)
116 | Dotnet local tool manifest file (tool-manifest)
117 | Web Config (webconfig)
118 | Uninstall Command:
119 | dotnet new -u Microsoft.DotNet.Common.ItemTemplates
120 |
121 | $ basename $(pwd)
122 | Common
123 | $ dotnet new classlib --no-restore
124 | The template "Class library" was created successfully.
125 | ```
126 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CleanData/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Project Creation Log
2 |
3 | ```
4 | $ date
5 | Fri Nov 13 22:17:51 UTC 2020
6 | $ dotnet --version
7 | 5.0.100
8 | $ # List installed templates.
9 | $ dotnet new --uninstall
10 | Template Instantiation Commands for .NET Core CLI
11 |
12 | Currently installed items:
13 | NUnit3.DotNetNew.Template
14 | Details:
15 | NuGetPackageId: NUnit3.DotNetNew.Template
16 | Version: 1.8.1
17 | Author: akharlov
18 | Templates:
19 | NUnit 3 Test Project (nunit) C#
20 | NUnit 3 Test Item (nunit-test) C#
21 | NUnit 3 Test Project (nunit) F#
22 | NUnit 3 Test Item (nunit-test) F#
23 | NUnit 3 Test Project (nunit) VB
24 | NUnit 3 Test Item (nunit-test) VB
25 | Uninstall Command:
26 | dotnet new -u NUnit3.DotNetNew.Template
27 |
28 | Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
29 | Details:
30 | NuGetPackageId: Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
31 | Version: 5.0.0
32 | Author: Microsoft
33 | Templates:
34 | ASP.NET Core with Angular (angular) C#
35 | ASP.NET Core with React.js (react) C#
36 | ASP.NET Core with React.js and Redux (reactredux) C#
37 | Uninstall Command:
38 | dotnet new -u Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
39 |
40 | Microsoft.DotNet.Test.ProjectTemplates.5.0
41 | Details:
42 | NuGetPackageId: Microsoft.DotNet.Test.ProjectTemplates.5.0
43 | Version: 1.0.2-beta4.20420.1
44 | Author: Microsoft
45 | Templates:
46 | Unit Test Project (mstest) C#
47 | Unit Test Project (mstest) F#
48 | Unit Test Project (mstest) VB
49 | xUnit Test Project (xunit) C#
50 | xUnit Test Project (xunit) F#
51 | xUnit Test Project (xunit) VB
52 | Uninstall Command:
53 | dotnet new -u Microsoft.DotNet.Test.ProjectTemplates.5.0
54 |
55 | Microsoft.DotNet.Web.ItemTemplates
56 | Details:
57 | NuGetPackageId: Microsoft.DotNet.Web.ItemTemplates
58 | Version: 5.0.0
59 | Author: Microsoft
60 | Templates:
61 | Protocol Buffer File (proto)
62 | Razor Component (razorcomponent) C#
63 | Razor Page (page) C#
64 | MVC ViewImports (viewimports) C#
65 | MVC ViewStart (viewstart) C#
66 | Uninstall Command:
67 | dotnet new -u Microsoft.DotNet.Web.ItemTemplates
68 |
69 | Microsoft.DotNet.Web.ProjectTemplates.5.0
70 | Details:
71 | NuGetPackageId: Microsoft.DotNet.Web.ProjectTemplates.5.0
72 | Version: 5.0.0
73 | Author: Microsoft
74 | Templates:
75 | Blazor Server App (blazorserver) C#
76 | Blazor WebAssembly App (blazorwasm) C#
77 | ASP.NET Core Empty (web) C#
78 | ASP.NET Core Empty (web) F#
79 | ASP.NET Core gRPC Service (grpc) C#
80 | Razor Class Library (razorclasslib) C#
81 | ASP.NET Core Web App (webapp) C#
82 | ASP.NET Core Web App (Model-View-Controller) (mvc) C#
83 | ASP.NET Core Web App (Model-View-Controller) (mvc) F#
84 | ASP.NET Core Web API (webapi) C#
85 | ASP.NET Core Web API (webapi) F#
86 | Worker Service (worker) C#
87 | Worker Service (worker) F#
88 | Uninstall Command:
89 | dotnet new -u Microsoft.DotNet.Web.ProjectTemplates.5.0
90 |
91 | Microsoft.DotNet.Common.ProjectTemplates.5.0
92 | Details:
93 | NuGetPackageId: Microsoft.DotNet.Common.ProjectTemplates.5.0
94 | Version: 5.0.0
95 | Author: Microsoft
96 | Templates:
97 | Class library (classlib) C#
98 | Class library (classlib) F#
99 | Class library (classlib) VB
100 | Console Application (console) C#
101 | Console Application (console) F#
102 | Console Application (console) VB
103 | Uninstall Command:
104 | dotnet new -u Microsoft.DotNet.Common.ProjectTemplates.5.0
105 |
106 | Microsoft.DotNet.Common.ItemTemplates
107 | Details:
108 | NuGetPackageId: Microsoft.DotNet.Common.ItemTemplates
109 | Version: 5.0.0
110 | Author: Microsoft
111 | Templates:
112 | dotnet gitignore file (gitignore)
113 | global.json file (globaljson)
114 | NuGet Config (nugetconfig)
115 | Solution File (sln)
116 | Dotnet local tool manifest file (tool-manifest)
117 | Web Config (webconfig)
118 | Uninstall Command:
119 | dotnet new -u Microsoft.DotNet.Common.ItemTemplates
120 |
121 | $ basename $(pwd)
122 | CleanData
123 | $ dotnet new console --no-restore
124 | The template "Console Application" was created successfully.
125 | ```
126 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CompileData/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Project Creation Log
2 |
3 | ```
4 | $ date
5 | Fri Nov 13 22:41:04 UTC 2020
6 | $ dotnet --version
7 | 5.0.100
8 | $ # List installed templates.
9 | $ dotnet new --uninstall
10 | Template Instantiation Commands for .NET Core CLI
11 |
12 | Currently installed items:
13 | NUnit3.DotNetNew.Template
14 | Details:
15 | NuGetPackageId: NUnit3.DotNetNew.Template
16 | Version: 1.8.1
17 | Author: akharlov
18 | Templates:
19 | NUnit 3 Test Project (nunit) C#
20 | NUnit 3 Test Item (nunit-test) C#
21 | NUnit 3 Test Project (nunit) F#
22 | NUnit 3 Test Item (nunit-test) F#
23 | NUnit 3 Test Project (nunit) VB
24 | NUnit 3 Test Item (nunit-test) VB
25 | Uninstall Command:
26 | dotnet new -u NUnit3.DotNetNew.Template
27 |
28 | Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
29 | Details:
30 | NuGetPackageId: Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
31 | Version: 5.0.0
32 | Author: Microsoft
33 | Templates:
34 | ASP.NET Core with Angular (angular) C#
35 | ASP.NET Core with React.js (react) C#
36 | ASP.NET Core with React.js and Redux (reactredux) C#
37 | Uninstall Command:
38 | dotnet new -u Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0
39 |
40 | Microsoft.DotNet.Test.ProjectTemplates.5.0
41 | Details:
42 | NuGetPackageId: Microsoft.DotNet.Test.ProjectTemplates.5.0
43 | Version: 1.0.2-beta4.20420.1
44 | Author: Microsoft
45 | Templates:
46 | Unit Test Project (mstest) C#
47 | Unit Test Project (mstest) F#
48 | Unit Test Project (mstest) VB
49 | xUnit Test Project (xunit) C#
50 | xUnit Test Project (xunit) F#
51 | xUnit Test Project (xunit) VB
52 | Uninstall Command:
53 | dotnet new -u Microsoft.DotNet.Test.ProjectTemplates.5.0
54 |
55 | Microsoft.DotNet.Web.ItemTemplates
56 | Details:
57 | NuGetPackageId: Microsoft.DotNet.Web.ItemTemplates
58 | Version: 5.0.0
59 | Author: Microsoft
60 | Templates:
61 | Protocol Buffer File (proto)
62 | Razor Component (razorcomponent) C#
63 | Razor Page (page) C#
64 | MVC ViewImports (viewimports) C#
65 | MVC ViewStart (viewstart) C#
66 | Uninstall Command:
67 | dotnet new -u Microsoft.DotNet.Web.ItemTemplates
68 |
69 | Microsoft.DotNet.Web.ProjectTemplates.5.0
70 | Details:
71 | NuGetPackageId: Microsoft.DotNet.Web.ProjectTemplates.5.0
72 | Version: 5.0.0
73 | Author: Microsoft
74 | Templates:
75 | Blazor Server App (blazorserver) C#
76 | Blazor WebAssembly App (blazorwasm) C#
77 | ASP.NET Core Empty (web) C#
78 | ASP.NET Core Empty (web) F#
79 | ASP.NET Core gRPC Service (grpc) C#
80 | Razor Class Library (razorclasslib) C#
81 | ASP.NET Core Web App (webapp) C#
82 | ASP.NET Core Web App (Model-View-Controller) (mvc) C#
83 | ASP.NET Core Web App (Model-View-Controller) (mvc) F#
84 | ASP.NET Core Web API (webapi) C#
85 | ASP.NET Core Web API (webapi) F#
86 | Worker Service (worker) C#
87 | Worker Service (worker) F#
88 | Uninstall Command:
89 | dotnet new -u Microsoft.DotNet.Web.ProjectTemplates.5.0
90 |
91 | Microsoft.DotNet.Common.ProjectTemplates.5.0
92 | Details:
93 | NuGetPackageId: Microsoft.DotNet.Common.ProjectTemplates.5.0
94 | Version: 5.0.0
95 | Author: Microsoft
96 | Templates:
97 | Class library (classlib) C#
98 | Class library (classlib) F#
99 | Class library (classlib) VB
100 | Console Application (console) C#
101 | Console Application (console) F#
102 | Console Application (console) VB
103 | Uninstall Command:
104 | dotnet new -u Microsoft.DotNet.Common.ProjectTemplates.5.0
105 |
106 | Microsoft.DotNet.Common.ItemTemplates
107 | Details:
108 | NuGetPackageId: Microsoft.DotNet.Common.ItemTemplates
109 | Version: 5.0.0
110 | Author: Microsoft
111 | Templates:
112 | dotnet gitignore file (gitignore)
113 | global.json file (globaljson)
114 | NuGet Config (nugetconfig)
115 | Solution File (sln)
116 | Dotnet local tool manifest file (tool-manifest)
117 | Web Config (webconfig)
118 | Uninstall Command:
119 | dotnet new -u Microsoft.DotNet.Common.ItemTemplates
120 |
121 | $ basename $(pwd)
122 | CompileData
123 | $ dotnet new console --no-restore
124 | The template "Console Application" was created successfully.
125 | ```
126 |
--------------------------------------------------------------------------------
/notes/2018-12-30-commenting.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 Re: [請益] 寫註解到底是不是好習慣
5 | 時間 Sun Dec 30 17:52:48 2018
6 | ```
7 |
8 | 先說結論:「二分法命題比較有得戰、比較熱鬧;若像下面這樣去考量各種層面的
9 | 話,會很無聊 XD 。」
10 |
11 |
12 | # 從 電腦科學 的角度來看
13 |
14 | 所謂「寫程式」的「寫」,在抽象意義上即是「表達(express)」 ;每種實用的語
15 | 言多半有其強項與短處,也就是方便與不方便的用途。
16 |
17 | 例如說,用 程式語言 來表達計算(computation)過程 ,尤其是表達給電腦看的計
18 | 算指令,通常來說會比用 自然語言 來得方便。
19 |
20 | 用 自然語言 (配合科學/數學符號) 來描述、解釋問題,尤其是表達給人腦看的脈
21 | 絡上下文(context) ,通常來說會比用 程式語言 來得方便。
22 |
23 | 是故,如果一個問題(problem) 是簡單(simple)到可以從其
24 | 計算解決方案(solution)去反推出問題的全貌,那麼,的確用程式語言去描述計算
25 | 過程就可以了,也就是「不太需要去寫註解」。
26 |
27 | 反之,如果一個問題的複雜度高,或其脈絡是難以用程式語言去描述的,那麼,就
28 | 可以用自然語言這個更適合的工具,去描述該問題的脈絡,也就是「有寫註解的價
29 | 值」。
30 |
31 | 有興趣的話,可以參考 DSL/GPL 的觀念:
32 |
33 | * https://en.wikipedia.org/wiki/Domain-specific_language
34 | * https://en.wikipedia.org/wiki/General-purpose_language
35 |
36 |
37 | # 從 軟體工程 的角度來看
38 |
39 | 前面板友 ThxThx 在推文 [1] 裡點出的文章,有更深入完整地探討這個方向。
40 |
41 | * http://antirez.com/news/124
42 | * https://www.reddit.com/9m6ahs
43 |
44 | Hacker News 上也討論過 antirez 的那篇文。
45 |
46 | * https://news.ycombinator.com/item?id=18157047
47 |
48 | [1]: https://www.ptt.cc/bbs/Soft_Job/M.1546056944.A.99E.html
49 |
50 | 以下是對原文的摘要,加上簡略的、我的解讀與看法;作者 antirez 把註解分為
51 | 9 大類如下,且主張:「前 6 大類是相對有正面價值的,後 3 大類則有疑慮
52 | 。」
53 |
54 | > * Function comments
55 |
56 | 「函式註解」,可以想成「介面(interface), API 」註解。
57 |
58 | > * Design comments
59 |
60 | 設計藍圖、大方向的註解。
61 |
62 | > * Why comments
63 |
64 | 相對於描述「如何(how)」的程式碼 ,解釋「意圖、原因」的註解。
65 |
66 | > * Teacher comments
67 |
68 | 深入解釋「問題的脈絡/領域(domain)」的註解 ,例如,某數學公式的由來
69 | 。
70 |
71 | > * Checklist comments
72 |
73 | 列出「提醒/警示」的清單註解 ,例如,幫助後人避免踩中技術細節的地雷。
74 |
75 | > * Guide comments
76 |
77 | 「導讀」註解。
78 |
79 | > * Trivial comments
80 |
81 | 解釋「不言自明」之事的註解;讀這類註解所需要花的精神,不見得比直接讀程式碼
82 | 來得少,且不見得能幫助讀者更了解此程式要解決的問題。
83 |
84 | > * Debt comments
85 |
86 | 技術債註解;或許應該以 issue/bug 的方式記錄技術債,而不是藏在程式碼
87 | 裡。
88 |
89 | > * Backup comments
90 |
91 | 以 備份 為目的,把舊的程式碼以註解的方式留在程式碼檔案裡。
92 |
93 | 易言之,不同型式的註解有不同的用途與價值。
94 |
95 |
96 | # 從 人體工程 的角度來看
97 |
98 | 相對於 軟體工程 , 人體工程 XD 是更困難的。
99 |
100 | 真正的問題通常不是技術問題,而是認知、環境、歷史等脈絡上的問題,尤其是那
101 | 些「沒有被說出來 / 沒有便利的共同語言去表達」 的東西。
102 |
103 | 那些東西對輕重緩急的取捨拿捏有極顯著的影響與衝擊,卻又常常是無影無形難以
104 | 捕捉、表達、溝通。
105 |
106 | (「人體工程」離原主題太遠了,就此打住。)
107 |
108 | [編輯補充] 就「人體工程」這個題目,可以參考 qrtt1 寫的這篇:
109 | https://www.ptt.cc/bbs/Soft_Job/M.1546144956.A.439.html
110 |
111 | # 結論
112 |
113 | 扁平化、二分法命題比較有得戰、比較熱鬧;若像上面這樣去考量各種層面、脈絡
114 | 的話,會很無聊,很難戰 XD 。
115 |
116 | ```
117 | --
118 | 個人 雜談、學習、英語、軟體
119 | https://www.facebook.com/tw.yang.30 https://www.facebook.com/30abysses/
120 | https://twitter.com/twy30 http://www.30abysses.com/
121 |
122 | --
123 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.102.149
124 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1546163575.A.4C5.html
125 | 推 oneheat: 你這個太無聊了,應該沒幾個人會回 12/30 17:54
126 |
127 | XD
128 |
129 | ※ 編輯: AmosYang (136.56.102.149), 12/30/2018 17:57:44
130 | ※ 編輯: AmosYang (136.56.102.149), 12/30/2018 17:59:12
131 | 推 t64141: 光第一句就該推了XD 12/30 17:58
132 |
133 | 此串開頭原po在解 天才小釣手 的成就 XD
134 | ※ 編輯: AmosYang (136.56.102.149), 12/30/2018 18:05:13
135 | 推 t64141: 看完,再推一次 12/30 18:02
136 | → pttworld: 註解分類是有意義的,討論串某些推文明顯和內文不同類 12/30 18:07
137 | → yougigun: end 12/30 18:16
138 | 推 landlord: 言之有物,推! 12/30 18:17
139 | 推 jaspreme206: 推 12/30 18:18
140 | 推 nelley: 推這篇 12/30 18:51
141 | 推 v86861062: :) 12/30 19:02
142 |
143 | [編輯補充] 就「人體工程」這個題目,可以參考 qrtt1 寫的這篇:
144 | https://www.ptt.cc/bbs/Soft_Job/M.1546144956.A.439.html
145 | ※ 編輯: AmosYang (136.56.102.149), 12/30/2018 19:18:37
146 | → qrtt1: 用人體有色色的感覺 12/30 19:47
147 | 推 babelism: 九類註解很值得借鑑,和我的觀點重合處甚多 12/30 22:35
148 | 推 sa074463: 推 12/30 23:00
149 | 推 rollr: 水準太高 12/31 01:39
150 | 推 Ghamu: 事實上就有好的有不好 應該的 不應該的註解這樣 12/31 02:11
151 | → Ghamu: 但一堆真的都拿爛註解來說該寫註解好棒棒 真的不敢恭維 12/31 02:13
152 | 推 kyrie77: 推這篇 12/31 02:53
153 | 推 freepenguin: 推 12/31 11:33
154 | 推 Ouranos: 推推~ 12/31 13:40
155 | 推 pttuser2266: 原本很好戰的主題,不要打擾我我看戲 12/31 14:13
156 | 推 ppc: 推個 12/31 14:40
157 | 推 vn509942: 感謝大大整理分享 01/01 10:49
158 | 推 agra: 這個切分分類視角很不錯,有看有推! 01/01 14:13
159 | 推 polola6212: 這串下來只有這篇有營養........ 01/03 01:39
160 | 推 crow1270: 推 01/03 19:09
161 | 推 leicheong: Warning comments: 當你在用第三方程式庫有gotcha 01/04 21:11
162 | → leicheong: 例如statement需要特定順序執行或者有bug而需要 01/04 21:11
163 | → leicheong: workaround, 而說明文件沒標示 (例如微軟去年公佈必須 01/04 21:13
164 | → leicheong: 開啟SMB1才能正常運作的軟體清單... 很多人一直都沒 01/04 21:14
165 | → leicheong: 想到SMB1居然會被更新停用, 而且沒幾個人會知道在用 01/04 21:15
166 | → leicheong: 的lib的技術細節吧)這些一定得下註解 01/04 21:16
167 | → rocwild: 簡單說就是看寫什麼樣的註解吧。比如說“問題(problem) 01/05 11:41
168 | → rocwild: ”也是一種註解。 01/05 11:41
169 | ```
170 |
--------------------------------------------------------------------------------
/notes/2020-10-02-naming.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得] 「命名」這個問題的本質
5 | 時間 Sat Oct 3 05:56:59 2020
6 | ```
7 |
8 | 《程式英文》 https://github.com/EngTW/English-for-Programmers 上週跨過了
9 | 「GitHub 500 星」的里程碑,在此整理一下這 12 週以來的心得。
10 |
11 | * 討論了 64 個與程式寫作有關的英文字
12 | * 每週新主題的熱門程度不一,點閱人次分佈在 3000 ~ 5000
13 | * 每週流量有大約 10% 是重訪既有主題
14 |
15 | ---
16 | * Google 文件 https://bit.ly/2GvWwV2
17 | * GitHub 討論區 https://bit.ly/321ResR
18 |
19 | ---
20 | # 「命名」這個問題的本質
21 |
22 | 寫程式時,「好的命名」的作用可說是:
23 |
24 | * 以精練的文字引導程式碼讀者的大腦聚焦在最重要的相關知識與經驗上
25 | * 進而掌握程式碼的 How & Why
26 |
27 | 「好的命名」很重要,但「命名得好」很難,我將「命名的難處」歸納如下:
28 |
29 | * 缺乏學習誘因
30 | * 就「寫程式的當下」來說,最低限度的要求/短期報酬最高的目標,可說是「
31 | 寫出能用的程式」。
32 | * 而「可讀性/好的命名」的短期報酬相對地低。
33 | * 缺乏練習環境
34 | * 就「語法、邏輯」來說,取得意見回饋很容易;可以用程式語言工具檢查語法
35 | ,可以演算驗證邏輯。
36 | * 而「可讀性/命名」的品質評鑑是相對地困難。
37 | * 缺乏技術指導
38 | * 在這個時代可以找到許多「命名常規(convention)」的資料,是很有用的「語
39 | 法(syntax)、格式(format)」參考資料;同時,也有相當的資料在探討「命名
40 | 的原則」及討論「命名案例」。
41 | * 而「命名的語意(semantics)」的資料相對地少。
42 |
43 | ---
44 | 那麼,要如何克服上述的難處?我的看法如下:
45 |
46 | ## 學習誘因
47 |
48 | 誘因(incentive)、動機(motivation)是個很大的題目,這裡先談個人容易著手的
49 | 方向:「管理工作記憶區、調節情緒」,也就是降低「問題的複雜度、覺得困難的
50 | 情緒」對動機的負面影響。
51 |
52 | 易言之,如果目前無法做到「一次寫出能用又好讀的程式」,試試分成「寫出能用
53 | 的程式」、「寫出好讀的程式」兩個步驟來做。
54 |
55 | 可以參考 Test-Driven Development (TDD) 工程方法的原則,先寫出「能用、好
56 | 掌握、好測試的程式」,再來改善程式的可讀性(後面會探討實作方法)。
57 |
58 | 另一方面,「團隊文化、報酬制度」是個人相對難著力的方向,因為那通常不是技
59 | 術問題,而是商業問題。
60 |
61 | ## 練習環境
62 |
63 | 這個時代有不少「語法檢查工具」,但幾乎沒有「語意檢查工具」;目前我能想到
64 | 的替代品有三:
65 |
66 | * Pair Programming
67 | * Code Review
68 | * 社群討論
69 | * 例如這一系列文章
70 | * 或我開設的 https://github.com/EngTW/English-for-Programmers/issues
71 |
72 | 或許,將來有一天,《程式英文》累積了足夠了「命名」知識與經驗,可以試著開
73 | 發出某種「命名語意檢查工具」,但目前還是得依賴人腦。
74 |
75 | ## 技術指導
76 |
77 | 這個時代有很多很棒的書與參考資料,但我發現既有的參考資料在「命名的語意」
78 | 這方面相對的薄弱。而對母語非英語的我們來說還有「英文語意」這個門檻。
79 |
80 | 經過過去 12 週的嘗試,我發現從語源學(etymology)的角度可以有效地釐清英文
81 | 字的語意;《程式英文》會繼續探討「程式命名常用字」的語意、字面上的意思
82 | denotation vs. 使用情景中的意思 connotation 、語法、格式。
83 |
84 | 另一方面,我從學術論文著手,看看學界是怎麼研究「程式命名」這個題目;以下
85 | 是我最近讀的資料的歸納整理:
86 |
87 | ### 「命名」的方法
88 |
89 | 0. 當你想要命名一個東西時
90 | 1. 你想要傳達的概念有哪些?例如:
91 | * 需求,這東西的目的為何?它被用來解決什麼問題?
92 | * 情境,這東西的上下文為何?
93 | * 地雷,這東西有什麼違反直覺、違反業界常規的地方?
94 | * 參考 https://www.ptt.cc/bbs/Soft_Job/M.1546163575.A.4C5.html ,還有
95 | 哪些概念會讓你覺得需要為它寫註解?
96 | 2. 把這些概念記錄下來
97 | * 不要在意文法、不要在意用字、不要在意篇幅長短
98 | * 先粗略地大量蒐集資料,之後再來精練品質
99 | 3. 避開「知識的詛咒」,例如:
100 | * 暫時離開這個工作環境,讓你的大腦忘掉這一切
101 | * 或著,找人跟你 pair programming, code review, 討論
102 | 4. 把那些概念依重要性排序
103 | * 就團隊文化、業界常規來說,有哪些概念是獨特到要特別說出來的?
104 | 5. 就最重要的概念來說,有哪些字可以代表該概念?
105 | 6. 用那些字來組合出那東西的名字
106 | 7. 找人 code review, 評估你想出來的名字的品質,是否能做到:
107 | * 以精練的文字引導程式碼讀者的大腦聚焦在最重要的相關知識與經驗上
108 | * 進而掌握程式碼的 How & Why
109 |
110 | 參考資料:
111 |
112 | * Feitelson, D., Mizrahi, A., Noy, N., Shabat, A. B., Eliyahu, O., &
113 | Sheffer, R. (2020). How Developers Choose Names. IEEE Transactions on
114 | Software Engineering.
115 |
116 | ### 「鑑定命名品質」的方法
117 |
118 | * 命名要適合放在工作記憶區的大小
119 | * 一般人腦大約能同時掌握 3 ~ 4 個概念與那些概念之間的關係
120 | * 一般人腦的「一看就懂」是指在約 2 秒內能看懂一個概念
121 | * 母語為英語者,一般閱讀速度是約 1 秒 4 個英文字
122 | * 命名要精練(concise),例如:
123 | * 假設我們想要命名「輸出檔案的名稱」變數
124 | * `output_file_name` 是個好名字,它 正確 且 精練
125 | * `file_name` 會是個 正確 但 不精練 (不嚴謹) 的名字
126 | * `foo` 是 不正確 也 不精練
127 | * 命名要一致(consistent)
128 | * 假設某程式中, `file` 在某個地方代表「檔案名稱」,
129 | * 在另一個地方代表「檔案指標(pointer)」,
130 | * 這是不一致的
131 | * 這裡的問題是「同一個名稱 對應到 多個概念」
132 | * 假設某程式中, `file` 在某個地方代表「檔案名稱」,
133 | * 在另一個地方, `file_name` 也代表「檔案名稱」,
134 | * 這也是不一致的
135 | * 這裡的問題是「多個名稱 對應到 同一個概念」
136 |
137 | 參考資料:
138 |
139 | * Deissenboeck, F., & Pizka, M. (2006). Concise and consistent naming.
140 | Software Quality Journal, 14(3), 261-282.
141 |
142 | ---
143 | 我還在慢慢消化這些學術論文;如果對我的閱讀筆記有興趣的話,可以看看這些:
144 |
145 | * https://www.facebook.com/twy30/posts/2641704649413183
146 | * https://www.facebook.com/twy30/posts/2641828296067485
147 | * https://www.facebook.com/twy30/posts/2630596570523991
148 | * https://www.facebook.com/twy30/posts/2592785380971777
149 | * https://www.facebook.com/twy30/posts/2630521400531508
150 | * https://www.facebook.com/twy30/posts/2630473677202947
151 |
152 | 除了「命名的語意」外,現有的「命名常規」資料似乎也很少提到「型別(type)」
153 | 對「程式可讀性」的影響;這也是個很有趣的研究方向。
154 |
155 | ---
156 | # 結語
157 |
158 | 「命名」這個題目很有趣,像是在打造一把鑰匙,可以打開讀者的大腦倉庫,提取
159 | 出一整個世界。
160 |
161 | 有任何關於軟體工程、程式設計的英文相關問題都很歡迎提出來討論;很多很有趣
162 | 的研究方向、靈感其實都是來自於讀者提問、意見回饋。
163 |
164 | 在此感謝所有參與討論的網友 :)
165 |
166 | ```
167 | --
168 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
169 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1601675826.A.A6D.html
170 | 推 adks3489: 推,命名依照用途而非內容物,就能提昇精鍊度 10/03 08:12
171 | 推 Downager: 推,這些討論很受用 10/03 16:08
172 | 推 alihue: 推推 10/03 17:25
173 | 推 Ouranos: 推推,謝謝分享~ 10/03 19:54
174 | 推 summerleaves: 優文 有看有推 10/04 12:52
175 |
176 | 謝謝各位的欣賞 :)
177 | ※ 編輯: AmosYang (136.56.13.184 美國), 10/05/2020 02:04:53
178 | 推 love99067333: 想問_和-的差異 10/05 02:26
179 |
180 | 如果你是指 var_name 與 var-name 這兩種寫作風格的差異,
181 |
182 | * 我目前尚未看到任何認知科學研究主張哪種比較好、怎麼個好法。
183 | * 我目前看到的多是「在這個文化生態圈中,就是習慣這樣寫」。
184 |
185 | ---
186 | 很像是「小數點」的情形;例如
187 |
188 | * 10,000.00 ← 台、美、日等國家習慣用 "." 來當小數點
189 | * 10.000,00 ← 歐洲、一些非州國家則是用 "," 來當小數點
190 |
191 | 沒有資料說哪種比較「好」,就是文化習慣。
192 |
193 | 參考資料: https://en.wikipedia.org/wiki/Decimal_separator
194 | ※ 編輯: AmosYang (136.56.13.184 美國), 10/05/2020 04:29:36
195 | 推 guest0710: 感謝你 10/06 22:12
196 | 推 v9290026: 推推 10/07 12:24
197 | 推 BlazarArc: 推 10/08 21:22
198 |
199 | 謝謝各位的欣賞 :)
200 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/08/2020 12:56:41
201 | ```
202 |
--------------------------------------------------------------------------------
/notes/2020-08-14-check-test-verify-validate.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「檢查」功能
5 | 時間 Fri Aug 14 13:20:23 2020
6 | ```
7 |
8 | 這週的題目是:「檢查」的相關動詞。
9 |
10 | * 如何命名「檢查」功能?
11 | * Check, Test, Verify, Validate 有什麼不一樣?
12 |
13 | ---
14 | * Google 簡報 https://bit.ly/31UiEPK
15 | * Facebook 相簿 https://bit.ly/31NqsCU
16 | * GitHub 討論 https://bit.ly/321ResR
17 |
18 | ---
19 | # 先說結論
20 |
21 | * 如果不確定該用哪個動詞,就用 *Check*
22 |
23 | ---
24 | # 所謂「檢查」這個動作
25 |
26 | 相對於模糊邏輯 (fuzzy logic),我們在寫程式時多半使用
27 | 古典邏輯 (classical logic),也就是以「真、假」二元的方式來表示邏輯、進行
28 | 運算;例如,以下程序:
29 |
30 | 1. 如果
31 | 1. 「使用者有讀取權限」為真
32 | 2. 就
33 | 1. 傳回資料
34 | 3. 否則
35 | 1. 丟出錯誤
36 |
37 | 在我們寫的程式中,常常需要「檢查」程式邏輯模型的狀態,然後做出判斷,決定
38 | 程式下一步的行為。
39 |
40 | 這就是這週的題目:「檢查」的相關動詞。
41 |
42 | ---
43 | # 檢查: Check
44 |
45 | Check 可說是最萬用的「檢查」動詞,它可以用來:
46 |
47 | * 檢查「有無」
48 | * Windows 更新
49 | * 讀寫權限
50 | * 新 email
51 |
52 | * 檢查「對錯」
53 | * 拼字、文法
54 |
55 | * 檢查「狀態、品質」
56 | * 網路連線 有無 連上
57 | * 硬碟空間 是否 足夠
58 |
59 | 幾乎什麼都可以來 *check* 一下。
60 |
61 | 如果不確定要用什麼動詞來表達
62 |
63 | * 檢查有無、對錯、是否
64 | * 檢查系統狀態,做出判斷,傳回詳細資訊
65 |
66 | 的動作,用 check 大概不會有錯。 XD
67 |
68 | 接下來,以 check 為基準來比較幾個「檢查」相關動詞在語意上的特點。
69 |
70 | ---
71 | # 「檢查 + 後續動作」的動詞
72 |
73 | 相對於單純只執行「檢查」的 check,assert 與 ensure 分別代表以下兩個常用
74 | 的「檢查 + 後續動作」程式結構。
75 |
76 | ## Assert
77 |
78 | 「檢查之後,若系統不滿足條件,丟出錯誤」。
79 |
80 | 1. 檢查「某條件C」
81 | 2. 若
82 | 1. 「某條件C」為假
83 | 3. 就
84 | 1. 丟出錯誤
85 |
86 | ## Ensure
87 |
88 | 「檢查之後,若系統不滿足條件,採取行動確保系統狀態合乎條件」。
89 |
90 | 1. 檢查「某條件C」
91 | 2. 若
92 | 1. 「某條件C」為假
93 | 3. 就
94 | 1. 採取行動以確保系統狀態合乎「某條件C」的要求
95 |
96 | ---
97 | # 重視實驗的「測試 (test)」動詞
98 |
99 | * 檢查 (check) 偏向「從系統讀取資訊來做出判斷、回報結果」
100 | * 測試 (test) 偏向「與系統互動並觀察其反應來做出判斷、回報結果」
101 |
102 | 以「有無讀寫權限」為例:
103 |
104 | * 檢查 (check) 可能會拿著目前使用者的身分符記 (token) ,詢問作業系統該使
105 | 用者是否有讀寫權限,然後回傳檢查結果。
106 | * 測試 (test) 可能會以目前使用者的權限,直接去試試看能否真的執行讀寫動作
107 | ,然後回傳測試結果。
108 |
109 | ---
110 | # 重視預期正確答案的「驗證」動詞
111 |
112 | 相對於檢查(check) ,「驗證」偏向於「讀取資訊,與預期的正確答案比對,回報
113 | 結果或丟出錯誤」。
114 |
115 | 以「 email 格式正確與否」為例, validate 比 check 更能強調「驗證是否合乎
116 | 規範標準」。
117 |
118 | 以「使用者密碼正確與否」為例, verify 比 check 更能強調「驗證是否合乎已
119 | 知的正確答案」。
120 |
121 | ---
122 | # 確認 (confirm) vs. 驗證 (verify)
123 |
124 | 確認 (confirm) 與驗證 (verify) 兩者都可以用來檢查「事情是否準確、真實」
125 | ,但它們在語意上有微妙的差異:
126 |
127 | * 確認 (confirm) 傾向「確定想法;消除疑慮、不確定性」。
128 | * 在前端設計,會以 confirm 或 OK 來讓使用者「確認」執行它的選擇;而不
129 | 常用 verify 。
130 | * 在日常會話,會以 confirm 作為動詞來「確認」行程;而不常用 verify 。
131 |
132 | * 驗證 (verify) 傾向「取得資訊、進行實驗來判斷事情是否正確」。
133 | * 在前端設計,會以 verify 來提示使用者「驗證」它的手機。
134 | * 在後端設計,會以 verify 來命名「檢查事情是否準確、真實」的方法;而不
135 | 常用 confirm 。
136 |
137 | ---
138 | # 其它情境
139 |
140 | 在某些相對少見的情境下,「檢查」有它的習慣用字,例如:
141 |
142 | * authenticate : 檢查使用者身分真偽
143 | * scan : 大範圍檢查;掃描
144 | * ping : 檢查遠端伺服器、服務的狀態
145 | * analyze : 檢查系統行為現象的本質;分析
146 | * audit : 全面嚴謹地檢查系統的行為;審察
147 | * diagnose : 檢查問題的原因;診察
148 | * inspect : 檢查是否滿足某種標準;稽察
149 |
150 | 其它還有 examine、investigate、review 等字;在程式碼中相對地罕見,在文書
151 | 或註解中比較常見。
152 |
153 | ---
154 | # 結語
155 |
156 | 一週探索一個題目,逐漸把寫程式會用到的英文知識整理起來;每個人都是從零開
157 | 始學起的,我也從讀者提問中學到了很多 :)
158 |
159 | 如果你在寫程式時有遇到英文表達上的問題,歡迎留言討論,或到《程式英文》
160 | GitHub 討論區 https://bit.ly/321ResR 提問。
161 |
162 | 這可以幫助我把這個列表整理的更完善,謝謝 :)
163 |
164 | ```
165 | --
166 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
167 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1597382427.A.19A.html
168 | 推 y956403: 感謝分享 08/14 14:02
169 | 推 alihue: 做成工具(書/web)讓人查好像不錯 08/14 14:06
170 |
171 | 同意;長期來說會想往 HTML / GitHub Pages 的方向前進;方便閱讀、檢索、製
172 | 作、協作。
173 |
174 | → alihue: 感謝分享 08/14 14:06
175 | 推 sniper2824: 推個 08/14 14:08
176 | 推 DCTmaybe: 必須推 08/14 14:22
177 | 推 Tiguru: 推 08/14 15:30
178 | 推 tbpfs: 加油~一周一篇~一年後就可以出書了 08/14 15:40
179 |
180 | 謝謝鼓勵 :)
181 |
182 | 推 m234onica: 謝謝推 08/14 15:57
183 | 推 ericx790101: 感謝分享 08/14 18:10
184 | 推 chenshin0719: 推推 08/14 18:52
185 | 推 wjp1003: 推 08/14 19:14
186 | 推 tz5514: 推 08/14 19:31
187 | 推 Luke3723: 推 08/15 01:10
188 | 推 yyhsiu: 推,這個實用 08/15 01:14
189 |
190 | 謝謝各位的欣賞 :)
191 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/15/2020 12:40:07
192 | 推 summerleaves: 感謝分享! 08/15 12:35
193 | 推 scottxxx666: 推 08/15 14:07
194 | 推 azoaho: 推!非常感謝,對我幫助很大! 08/15 16:34
195 | 推 rapidsheep: 推推~ 08/15 19:26
196 | 推 jasonwung: 推 08/15 21:01
197 | 推 blueskier: 推 08/16 10:15
198 |
199 | 謝謝 :)
200 |
201 | 推 blueskier: 想問會不會做CURD操作的系列,很常用的幾個 08/16 10:18
202 |
203 | 是的,有打算做 CRUD 。
204 |
205 | 目前有一篇『如何命名「刪除」功能?』,可以參考以下連結:
206 |
207 | * #1V8-skH9 (Soft_Job)
208 | * https://www.ptt.cc/bbs/Soft_Job/M.1596190126.A.449.html
209 |
210 | C、R、U的部分還沒開始寫,但有開項目追蹤 :)
211 |
212 | * C: https://github.com/EngTW/English-for-Programmers/issues/28
213 | * R: https://github.com/EngTW/English-for-Programmers/issues/29
214 | * U: https://github.com/EngTW/English-for-Programmers/issues/30
215 |
216 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/16/2020 20:54:18
217 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/16/2020 20:59:45
218 | 推 Bencrie: 那順便許願一下 commit message 好了 XD 08/17 02:15
219 |
220 | 很有意思的題目 :)
221 |
222 | 能否談談你覺得「寫 commit message 時,多半卡在哪裡?」;例如說,句型、文
223 | 法、選字?
224 |
225 | 或著,若能談談「讓你覺得卡住的案例」,也能幫助我們找到解決問題的方向。
226 |
227 | ---
228 | 可以在這裡推文討論、 PTT 站內信 、或 Facebook/Twitter 私訊都可以 :)
229 |
230 | * https://www.facebook.com/twy30
231 | * https://twitter.com/twy30
232 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/17/2020 05:46:29
233 | 推 smily134: 推 08/17 12:48
234 | 推 helenalee: 推 08/18 14:57
235 | 推 s56565566123: Good分享感謝 08/20 08:24
236 |
237 | 謝謝各位的欣賞 :)
238 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/21/2020 12:40:58
239 | 推 BlazarArc: 推 08/21 15:15
240 |
241 | 謝謝 :)
242 |
243 | 推 zxcasdjason1: 推命名工具書 08/28 12:27
244 |
245 | 謝謝你的欣賞 :)
246 |
247 | → zxcasdjason1: 最近常常對定義新功能感到詞窮 08/28 12:28
248 |
249 | 有沒有興趣描述一下你遇到的困境?或許我可以幫上忙 :)
250 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/29/2020 07:47:32
251 | 推 mybluesky: 推 09/02 18:29
252 |
253 | 謝謝 :)
254 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/04/2020 12:13:48
255 | ```
256 |
--------------------------------------------------------------------------------
/notes/2020-11-07-LeetCode-naming.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 刷 LeetCode 練習命名
5 | 時間 Sun Nov 8 12:25:54 2020
6 | ```
7 |
8 | # 刷 LeetCode 練習命名
9 |
10 | 過去幾個月,《程式英文》把焦點放在「分享知識」;例如,變數名稱樣板、單字
11 | 使用情景、等等。對學習者來可說是「輸入」的動作。
12 |
13 | 這次試個不同的方向,做了個實驗,把焦點換到「演練技巧」,希望能幫助學習者
14 | 改善輸入與輸出的平衡。
15 |
16 | * Google 文件 https://bit.ly/2GIyLtk
17 | * GitHub 討論區 https://bit.ly/321ResR
18 |
19 | # 先說結論
20 |
21 | * 實驗內容:用 C# 刷 20 題「解題率最高、 Easy 等級」的 LeetCode
22 | * 題目列表: https://github.com/EngTW/English-for-Programmers/issues/69
23 | * 所有 20 題 LeetCode 英文題目(含提示)總共約 2841 字。
24 | * 其中 2434 字 (86%) 包含在「高中英文 7000 字」內。
25 | * 可還原成約 394 個單字原型;例如, am, are, is 的單字原型為 be 。
26 | * 其中 285 個單字原型 (72%) 包含在「高中英文 7000 字」內。
27 | * 所有 20 題 LeetCode 解答內「自訂變數」用了約 119 英文字。
28 | * 其中 105 字 (88%) 包含在「高中英文 7000 字」內。
29 | * 可還原成約 44 個單字原型。
30 | * 其中 36 個單字原型 (81%) 包含在「高中英文 7000 字」內。
31 |
32 | 以下是一些觀察與心得。
33 |
34 | # 堆疊( stack )字
35 |
36 | 在英文語法中,可以把多個字「堆疊( stack )」起來來表達意思,例如,程式
37 | 設計師熟知的 API: Application Programming Interface 。
38 |
39 | 這樣的語法也可以應用在命名變數上,但要小心拿捏資訊量與複雜度的平衡;例如:
40 |
41 | * 在有 1 個字的時候,例如, Name, 只有 1 種讀法,沒有問題。
42 | * 在有 2 個字的時候,例如, ManagerName, 仍只有 1 種讀法,沒有問題。
43 | * 在有 3 個字的時候,例如, StoreManagerName, 就有 2 種可能的讀法要去辨別:
44 | * StoreManager Name
45 | * Store ManagerName
46 | * 在有 4 個字的時候,例如, DollarStoreManagerName, 就有 (4-1)! = 6 種可
47 | 能的讀法要去辨別。
48 | * 在有 5 個字的時候,例如, CentralDollarStoreManagerName, 就有
49 | (5-1)! = 24 種可能的讀法要去辨別。
50 |
51 | 每多一個字的確會加入新的資訊,但也會提高閱讀的困難度(複雜度超過工作記憶
52 | 區的容量,使得資訊變成了雜訊)。
53 |
54 | 我個人經驗是「用 3 個字以下的變數名稱」,如果要用到超過 3 個字,或許可以
55 | 想想否是能用其它方法(程式碼架構、型別、註解、規格書、等等)來提供讀者理
56 | 解程式碼所需的上下文脈絡。
57 |
58 | # 是什麼( what )、為什麼( why )
59 |
60 | 以下這個案例很有趣:
61 |
62 | * https://github.com/EngTW/English-for-Programmers/issues/89
63 | * https://leetcode.com/problems/sum-of-all-odd-length-subarrays/
64 |
65 | 程式碼本身是在實作從題目要求推導出來的解答算式。
66 |
67 | 在這個案例中,我發現要描述「這個變數『是什麼』」並不難,難的是讓讀者了解
68 | 「為什麼要有這個變數」。
69 |
70 | 最後我選擇用註解的方式提示推導解答算式的方向,讀者需要先了解解答算式,程
71 | 式碼才會比較好懂。
72 |
73 | 相對之下,其它案例的變數的名稱與實際使用情形多半可以說明該變數「是什麼」
74 | 及「為什麼」。
75 |
76 | # 英文語法資料
77 |
78 | ## 位數
79 |
80 | 案例: https://github.com/EngTW/English-for-Programmers/issues/79
81 |
82 | * 個位: ones place 或 units place
83 | * 個位數: ones digit 或 units digit
84 | * 十位: tens place
85 | * 十位數: tens digit
86 | * 十分位: tenths place
87 | * 十分位數: tenths digit
88 |
89 | 參考資料
90 |
91 | * https://en.wikipedia.org/wiki/Numerical_digit#Computation_of_place_values
92 |
93 | ## 上限、下限、包含、不含
94 |
95 | 案例: https://github.com/EngTW/English-for-Programmers/issues/88
96 |
97 | * 上限: upper bound 或 majorant
98 | * 下限: lower bound 或 minorant
99 | * 包含: inclusive
100 | * 不含: exclusive
101 | * 參考資料
102 | * https://en.wikipedia.org/wiki/Upper_and_lower_bounds
103 | * https://www.lexico.com/en/definition/inclusive
104 | * https://www.lexico.com/en/definition/exclusive
105 |
106 | # 結語
107 |
108 | * 因為是第一次進行這樣的實驗,所以選了 LeetCode 是 Easy 級解題率最高的
109 | 20 題。
110 | * 從簡單題目開始,容易掌控問題複雜度,適合新手學習者入門。
111 | * 對進階學習者來說, LeetCode 的程式架構變化少,學習效果可能有限。
112 | * 題目定義明確,有共通的討論基礎。
113 | * 就現今軟體業求職面試文化來看,學習者投入「刷 LeetCode 」的成本容易回收。
114 | * LeetCode 題目是以英文寫成,也是練習英文的機會。
115 | * 解答的首項要求是正確,再來是可讀性,最後是效能(時間、空間)、程式碼語
116 | 法的精練度。
117 |
118 | 讀者如果有興趣的話,可以 code review 一下這裡列出來的 20 題 LeetCode 解
119 | 答,尤其是其「命名可讀性」;或著,對 LeetCode 題目或解答中的任何英文用字
120 | 、語文解讀有疑問的,也歡迎提出來討論。
121 |
122 | * https://github.com/EngTW/English-for-Programmers/issues/69
123 |
124 | 在此感謝所有參與討論的網友 :)
125 |
126 | ```
127 | --
128 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
129 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1604809565.A.3F9.html
130 | 推 ucrxzero: 是說linux跟windows的命名淺規則也不同 這有考慮ㄇ 11/08 15:02
131 | → ucrxzero: linux:my_name Windows:MyName 11/08 15:02
132 | → x246libra: 微軟有這個淺規則?那為什麼os大小寫沒區分,用git還 11/08 15:27
133 | → x246libra: 需要另外設定 11/08 15:27
134 | 推 ucrxzero: while Microsoft have always used capital letters for 11/08 15:47
135 | → ucrxzero: the functions and classes 11/08 15:47
136 | → ucrxzero: 我本身沒再寫Windows但Linux平田豐的書前面講規則有提到 11/08 15:49
137 | → ucrxzero: 一些命名差別,只是想問樓主的討論有沒有包括這部分 11/08 15:49
138 | → ucrxzero: 我也沒用小烏龜還是git bash都用linux command下的所以 11/08 15:50
139 | → ucrxzero: 你說的我也聽不懂 11/08 15:50
140 | 推 wulouise: 檔案命名規則跟實作不一樣很正常吧 11/08 17:54
141 | 推 wulouise: c#通常是camelCase, linux比較習慣 snake_case 11/08 17:58
142 | 推 Bencrie: 潛規則 11/08 20:30
143 | 推 CoNsTaR: 這篇重點完全不在名稱格式的 convention 上吧... 11/08 21:02
144 | 推 ucrxzero: 問問而已 11/08 21:15
145 |
146 | 我目前的研究方向傾向「命名的語意」 :)
147 |
148 | 例如,假設這裡有個變數是用來表達「上限值,而且包含該上限值」,那麼,要怎
149 | 麼命名這個變數?我會用 "inclusive upper bound" 這三個字。
150 |
151 | 確定了 "inclusive upper bound" 這三個字後,再來是「命名的語法」;這裡就
152 | 類似 ucrxzero 提到的「各社群、生態圈、專案會有它的潛規則」,
153 |
154 | * 在 C# 專案裡會寫成 inclusiveUpperBound
155 | * 在 Python 專案裡會寫成 inclusive_upper_bound
156 |
157 | 我個人的感覺是「命名的語法」比「命名的語意」容易掌握,因為「命名的語法」
158 | 的規則相對的單純。
159 |
160 | 「命名的語意」倚重「對美式英語的語感」,是母語為中文的我們相對不熟的部分
161 | ,是故,我整理這類資料的方向傾向「命名的語意」,覺得那比較能幫到學習者 :)
162 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/09/2020 06:09:50
163 |
164 | 公告一下 :)
165 |
166 | https://github.com/EngTW/English-for-Programmers/issues/91
167 |
168 | # 啟用「釋出(Release)」功能以減少通知信
169 |
170 | 以後主要的內容更新會以「釋出(Release)」的方式通知,例如:
171 |
172 | * https://github.com/EngTW/English-for-Programmers/releases/tag/2020-11-07
173 |
174 | 這樣子使用者可以選擇 "Releases only" 的追蹤(watch)選項,減少通知信。
175 |
176 | ---
177 |
178 | 很抱歉給有追蹤 EngTW/English-for-Programmers 的各位帶來了困擾 orz
179 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/09/2020 06:44:47
180 | 推 x246libra: 推 11/09 07:29
181 | 推 kangan987: 推 11/09 07:53
182 | 推 Ouranos: 必推,謝謝分享! 11/09 11:53
183 | 推 jasonwung: 推 11/09 13:27
184 | 推 y956403: 推 11/09 13:47
185 | 推 mirror0227: 推 11/09 14:08
186 |
187 | 謝謝各位的欣賞 :)
188 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/10/2020 04:13:28
189 | 推 rei0: 推 11/10 13:00
190 | 推 alimamado: 推 11/11 14:07
191 | 推 Lhmstu: 推推 11/12 16:11
192 |
193 | 謝謝 :)
194 | ※ 編輯: AmosYang (136.56.13.184 美國), 11/17/2020 07:58:59
195 | 推 showgunLa: 推推 11/21 08:56
196 | 推 billy8407: 推,命名很重要 11/21 17:09
197 | ```
198 |
--------------------------------------------------------------------------------
/ReadMe.md:
--------------------------------------------------------------------------------
1 | # 《程式英文》 English for Programmers
2 |
3 | 「英文」是不少人學程式的關卡,而「命名」是電腦科學最難的問題之一。
4 |
5 | 這裡搜集了常見的「如何用英文命名、表達程式裡某個東西?」的問題與答案,幫助你學會 **用英文提昇程式可讀性** 🔎 。
6 |
7 | ## 歡迎提出 問題 ❓ / 建議 💡 / 感想 💭
8 |
9 | 《程式英文》 GitHub 討論區 💬 https://bit.ly/321ResR
10 |
11 | # [縮寫、簡寫的優缺點](https://bit.ly/2JgaQCL)
12 |
13 | 2020-11-27 cognitive load
14 |
15 | * Google 文件 https://bit.ly/2JgaQCL
16 | * PTT 文章 https://bit.ly/2HHiO7d
17 | * [notes/2020-11-27-cognitive-load.md](notes/2020-11-27-cognitive-load.md)
18 | * Facebook 討論 https://bit.ly/2V6DoRl
19 | * Twitter 討論 https://bit.ly/2V9dso8
20 |
21 | # [高中6K字-108版](https://bit.ly/35C8AhB)
22 |
23 | 2020-11-16 JSON
24 |
25 | * 字表 Google Sheets 版 https://bit.ly/2ULo0tL
26 | * 字表 JSON 版 https://bit.ly/2ILggFo
27 | * Google 文件 https://bit.ly/35C8AhB
28 | * PTT 文章 https://bit.ly/2Iy6nLt
29 | * [notes/2020-11-16-Taiwan-high-school-6K-108-edition.md](notes/2020-11-16-Taiwan-high-school-6K-108-edition.md)
30 | * Facebook 討論 https://bit.ly/32Qe0ng
31 | * Twitter 討論 https://bit.ly/35Cgesn
32 |
33 | # [刷 LeetCode 練習命名](https://bit.ly/2GIyLtk)
34 |
35 | 2020-11-07 LeetCode, naming, stack, digit, place, upper bound, majorant,
36 | lower bound, minorant, inclusive, exclusive
37 |
38 | * Google 文件 https://bit.ly/2GIyLtk
39 | * PTT 文章 https://bit.ly/3k8L6EN
40 | * [notes/2020-11-07-LeetCode-naming.md](notes/2020-11-07-LeetCode-naming.md)
41 | * Facebook 討論 https://bit.ly/3ldpEQq
42 | * Twitter 討論 https://bit.ly/3lcec7r
43 |
44 | # [「命名」這個問題的本質](https://bit.ly/2GvWwV2)
45 |
46 | 2020-10-02 naming
47 |
48 | * Google 文件 https://bit.ly/2GvWwV2
49 | * PTT 文章 https://bit.ly/36tInT8
50 | * [notes/2020-10-02-naming.md](notes/2020-10-02-naming.md)
51 | * [notes/2018-12-30-commenting.md](notes/2018-12-30-commenting.md)
52 | * Facebook 討論 https://bit.ly/3jtwdgH
53 | * Twitter 討論 https://bit.ly/3cSSP7J
54 |
55 | # [如何命名「分段」功能?](https://bit.ly/3mPCOEa)
56 |
57 | 2020-09-25 slice, split, detach, disconnect, delimiter, separator,
58 | divider, splitter, break
59 |
60 | * Google 簡報 https://bit.ly/3mPCOEa
61 | * PTT 文章 https://bit.ly/3i2ZKfy
62 | * [notes/2020-09-25-slice-split.md](notes/2020-09-25-slice-split.md)
63 | * Facebook 討論 https://bit.ly/2G3gI0a
64 | * Twitter 討論 https://bit.ly/2RVhIpE
65 |
66 | # [「屬性」該用哪個字?](https://bit.ly/32DAoAD)
67 |
68 | 2020-09-18 attribute, property
69 |
70 | * Google 簡報 https://bit.ly/32DAoAD
71 | * Facebook 討論 https://bit.ly/35PASpc
72 | * PTT 文章 https://bit.ly/3hJfR1P
73 | * [notes/2020-09-18-attribute-property.md](notes/2020-09-18-attribute-property.md)
74 | * Twitter 討論 https://bit.ly/2RBSLQ5
75 |
76 | # [如何命名「集合名詞」數量變數?](https://bit.ly/3m9PWDZ)
77 |
78 | 2020-09-11 size, return, result
79 |
80 | * Google 簡報 https://bit.ly/3m9PWDZ
81 | * Facebook 討論 https://bit.ly/33fQCix
82 | * PTT 文章 https://bit.ly/3kbqJY1
83 | * [notes/2020-09-11-size.md](notes/2020-09-11-size.md)
84 | * Twitter 討論 https://bit.ly/35pGG8F
85 |
86 | # [如何命名「狀態」變數?](https://bit.ly/2GtLobb)
87 |
88 | 2020-09-04 state, status, ordinal
89 |
90 | * Google 簡報 https://bit.ly/2GtLobb
91 | * Facebook 討論 https://bit.ly/2EW8BCq
92 | * PTT 文章 https://bit.ly/3boxC53
93 | * [notes/2020-09-04-state-status.md](notes/2020-09-04-state-status.md)
94 | * Twitter 討論 https://bit.ly/3jCLPhE
95 |
96 | # [如何命名「複製」功能?](https://bit.ly/3guPFaE)
97 |
98 | 2020-08-28 copy, clone, duplicate
99 |
100 | * Google 簡報 https://bit.ly/3guPFaE
101 | * Facebook 討論 https://bit.ly/2ExUOSl
102 | * PTT 文章 https://bit.ly/2EoIPXj
103 | * [notes/2020-08-28-copy-clone-duplicate.md](notes/2020-08-28-copy-clone-duplicate.md)
104 | * Twitter 討論 https://bit.ly/3hC9EFI
105 |
106 | # [如何命名「檢查」功能?2](https://bit.ly/3l161ey)
107 |
108 | 2020-08-21 validate, verify, argument, parameter
109 |
110 | * Google 簡報 https://bit.ly/3l161ey
111 | * Facebook 討論 https://bit.ly/3glA4Kd
112 | * [notes/2020-08-23-validate-verify.md](notes/2020-08-23-validate-verify.md)
113 | * PTT 文章 https://bit.ly/2CPyq6a
114 | * [notes/2020-08-21-validate-verify.md](notes/2020-08-21-validate-verify.md)
115 | * Twitter 討論 https://bit.ly/2QfUPfK
116 |
117 | # [如何命名「檢查」功能?](https://bit.ly/31UiEPK)
118 |
119 | 2020-08-14 check, test, verify, validate, assert, ensure, confirm,
120 | authenticate, scan, ping, analyze, audit, diagnose, inspect
121 |
122 | * Google 簡報 https://bit.ly/31UiEPK
123 | * Facebook 相簿 https://bit.ly/31NqsCU
124 | * PTT 文章 https://bit.ly/3ixdi3M
125 | * [notes/2020-08-14-check-test-verify-validate.md](notes/2020-08-14-check-test-verify-validate.md)
126 | * Twitter 討論 https://bit.ly/3fPEmti
127 |
128 | # [如何命名「次數」變數?](https://bit.ly/3a1lDcO)
129 |
130 | 2020-08-07 times, calculate, compute, sum, total
131 |
132 | * Google 簡報 https://bit.ly/3a1lDcO
133 | * Facebook 相簿 https://bit.ly/2DHjNSx
134 | * PTT 文章 https://bit.ly/30zS1QR
135 | * [notes/2020-08-07-times.md](notes/2020-08-07-times.md)
136 | * Twitter 討論 https://bit.ly/3aaNlEg
137 |
138 | # [如何命名「刪除」功能?](https://bit.ly/2XazA2P)
139 |
140 | 2020-07-31 clear, empty, delete, remove, clean, erase, cancel, dismiss
141 |
142 | * Google 簡報 https://bit.ly/2XazA2P
143 | * Facebook 相簿 https://bit.ly/2EsPmj9
144 | * PTT 文章 https://bit.ly/2DilNAm
145 | * [notes/2020-07-31-clear-empty-delete-remove.md](notes/2020-07-31-clear-empty-delete-remove.md)
146 | * Twitter 討論 https://bit.ly/2D57pM5
147 |
148 | # [如何命名「種類」?](https://bit.ly/2OOSpEs)
149 |
150 | 2020-07-24 type, kind, category, class, classification, sort, group,
151 | tag, attribute, property
152 |
153 | * Google 簡報 https://bit.ly/2OOSpEs
154 | * Facebook 相簿 https://bit.ly/3ju7sBz
155 | * PTT 文章 https://bit.ly/30Aqduc
156 | * [notes/2020-07-24-type-kind-category.md](notes/2020-07-24-type-kind-category.md)
157 | * Twitter 討論 https://bit.ly/2CYKgdZ
158 |
159 | # [一定要寫英文嗎?](https://bit.ly/2DGDhXd)
160 |
161 | 2020-07-17 ASCII, Unicode
162 |
163 | * Google 簡報: https://bit.ly/2DGDhXd
164 | * Facebook 相簿 : https://bit.ly/3fCF2mv
165 | * PTT 文章 : https://bit.ly/3eD2VsO
166 | * [notes/2020-07-17-ASCII-Unicode.md](notes/2020-07-17-ASCII-Unicode.md)
167 | * Twitter 討論 : https://bit.ly/2ZGtY2l
168 |
169 | # [如何命名「數量變數」?](https://bit.ly/3elcZGT)
170 |
171 | 2020-07-10 count, number, quantity
172 |
173 | * Google 簡報: https://bit.ly/3elcZGT
174 | * Facebook 相簿 : https://bit.ly/3iNsgDO
175 | * PTT 文章 : https://bit.ly/2DtNV3B
176 | * [notes/2020-07-10-count-number-quantity.md](notes/2020-07-10-count-number-quantity.md)
177 | * Twitter 討論 : https://bit.ly/32947Sc
178 |
--------------------------------------------------------------------------------
/notes/2020-09-25-slice-split.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「分段」功能?
5 | 時間 Fri Sep 25 11:13:12 2020
6 | ```
7 |
8 | # 本週主題 + 結論:
9 |
10 | * 分段 Slice, Split 有什麼不一樣?
11 | * Slice: 從大塊東西上削下小塊
12 | * Split: 把東西打碎成多塊
13 | * 分開 Detach, Disconnect 有什麼不一樣?
14 | * Detach: 把東西分開來
15 | * Disconnect: 切斷(東西中間的)連結
16 | * 分界點 Delimiter 有哪些概念相關字?
17 | * Separator: 分隔器、分隔物
18 | * Divider: 空間區塊中的分隔物
19 | * Splitter: 某些 UI 框架會用 splitter 來代表「分割(split)畫面的 UI 元件」
20 | * Break: 斷行(line break), 斷頁(page break)
21 |
22 | ---
23 | * GitHub 討論 https://bit.ly/321ResR
24 | * Google 簡報 https://bit.ly/3mPCOEa
25 |
26 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/35 討論
27 | 的網友。
28 |
29 | ---
30 | # Slice, Split 有什麼不一樣?
31 |
32 | * Slice: 從大塊東西上削下小塊
33 | * Split: 把東西打碎成多塊
34 |
35 | ## Slice
36 |
37 | * 語源:古法文 ← 法蘭克文(今法國北部) ← 古德文
38 | * 1300 年代:名詞「碎片」,動詞「擊碎」
39 | * 今日
40 | * 從大塊食物(麵包、肉、蛋糕)切下來的寬薄片狀小塊
41 | * (特別指食物)將東西切成寬薄片狀小塊
42 | * 從大塊東西上削下小塊
43 | * 電腦科學例子
44 | * .NET `Memory.Slice()`
45 | * .NET `Span.Slice()`
46 | * "array slicing" 從陣列中切出小陣列
47 | * 日常生活例子
48 | * 如何切洋蔥 how to slice an onion
49 | * 如何切鳳梨 how to slice a pineapple
50 |
51 | ## Split
52 |
53 | * 語源:古德文(今德國西部)
54 | * 1580, 1590 年代:動詞「分裂、裂開」,名詞「裂縫」
55 | * 1610 年代:「由裂開形成的木塊」
56 | * 今日
57 | * (強力)把東西打碎成多塊
58 | * 分裂、裂痕、裂縫
59 | * 電腦科學例子
60 | * .NET `Regex.Split()`
61 | * .NET `String.Split()`
62 | * Unix `split` 指令(把檔案拆成小塊)
63 | * 日常生活例子
64 | * 如何分割 iPad 螢幕 how to split screen on iPad
65 |
66 | ## 參考資料
67 |
68 | * https://en.wikipedia.org/wiki/Array_slicing
69 | * https://en.wikipedia.org/wiki/Split_(Unix)
70 | * https://www.etymonline.com/word/slice
71 | * https://www.etymonline.com/word/split
72 | * https://www.lexico.com/en/definition/slice
73 | * https://www.lexico.com/en/definition/split
74 |
75 | ---
76 | # Detach, Disconnect 有什麼不一樣?
77 |
78 | * Detach: 把東西分開來
79 | * Disconnect: 切斷(東西中間的)連結
80 |
81 | ## Detach
82 |
83 | * 語源:古法文
84 | * 1680 年代、今日:「為了特別的目的,把東西分開來」
85 | * 電腦科學例子
86 | * .NET `ObjectContext.Detach(object)`
87 | * Java `VirtualMachine.detach()`
88 | * 日常生活例子
89 | * 如何在 iMovie 中把聲音分離 how to detach audio in iMovie
90 | * 如何分開 Surface Book; how to detach Surface Book
91 |
92 | ## Disconnect
93 |
94 | * 語源:拉丁文
95 | * 1770 年代、今日:「切斷(東西中間的)連結」
96 | * 電腦科學例子
97 | * .NET `Socket.Disconnect()`
98 | * 日常生活例子
99 | * 如何移除汽車電池 how to disconnect a car battery
100 | * 如何移除 PS4 手把 how to disconnect a PS4 controller
101 |
102 | ## 參考資料
103 |
104 | * https://docs.microsoft.com/en-us/dotnet/api/system.data.objects.objectcontext.detach?view=netframework-4.8
105 | * https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.disconnect?view=netcore-3.1
106 | * https://docs.oracle.com/en/java/javase/15/docs/api/jdk.attach/com/sun/tools/attach/VirtualMachine.html#detach()
107 | * https://www.etymonline.com/word/detach
108 | * https://www.etymonline.com/word/disconnect
109 | * https://www.lexico.com/en/definition/detach
110 | * https://www.lexico.com/en/definition/disconnect
111 |
112 | ---
113 | # Delimiter 有哪些概念相關字?
114 |
115 | * 語源:法文 ← 拉丁文
116 | * delimit: 1852 年代,動詞「標記、固定邊界」
117 | * delimiter: 1960 年代、今日,在電腦領域中,用來標記 資料區塊/資料流 起
118 | 始、終結點的字元
119 |
120 | ## Separator
121 |
122 | 分隔器、分隔物。
123 |
124 | * 語源:拉丁文
125 | * 14 世紀未期:「把東西拉散開來」
126 | * 1600 年代:「分離主義者」
127 | * 1831 年代:「將東西分開來的機械裝置」
128 | * 今日:分隔器、分隔物
129 | * .NET 例子
130 | * `System.Windows.Controls.Separator` class; 用來分隔 UI 元件的 UI 元件
131 | * `String.Join(separator, ...)`; 把字串連接在一起的字串
132 | * `NumberFormatInfo.NumberDecimalSeparator`; 分隔整數位與小數位的符號
133 | * `NumberFormatInfo.NumberGroupSeparator`; 分隔整數位群組的符號
134 | * `Path.PathSeparator`; 分隔檔案路徑的符號
135 | * `Path.DirectorySeparatorChar`; 分隔檔案路徑中資料夾名稱的符號
136 | * 日常生活例子
137 | * 電池正負極中間的阻隔物
138 | * 分離原油中各種成分的分離器
139 | * 分離乳脂、乳清的分離器
140 |
141 | ## 參考資料
142 |
143 | * https://docs.microsoft.com/en-us/dotnet/api/system.globalization.numberformatinfo.numberdecimalseparator?view=netcore-3.1
144 | * https://docs.microsoft.com/en-us/dotnet/api/system.globalization.numberformatinfo.numbergroupseparator?view=netcore-3.1
145 | * https://docs.microsoft.com/en-us/dotnet/api/system.io.path.directoryseparatorchar?view=netcore-3.1
146 | * https://docs.microsoft.com/en-us/dotnet/api/system.io.path.pathseparator?view=netcore-3.1
147 | * https://docs.microsoft.com/en-us/dotnet/api/system.string.join?view=netcore-3.1
148 | * https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.separator?view=netcore-3.1
149 | * https://en.wikipedia.org/wiki/Delimiter
150 | * https://en.wikipedia.org/wiki/Separator_(electricity)
151 | * https://en.wikipedia.org/wiki/Separator_(milk)
152 | * https://en.wikipedia.org/wiki/Separator_(oil_production)
153 | * https://www.etymonline.com/word/delimiter
154 | * https://www.etymonline.com/word/separator
155 | * https://www.lexico.com/en/definition/separator
156 |
157 | ## Divider
158 |
159 | 空間區塊中的分隔物。
160 |
161 | * 語源:拉丁文
162 | * divide: 14 世紀早期,「把東西分裂成多塊」
163 | * divider: 1520 年代,「分配東西的人」
164 | * 1959 年代、今日,「(尤其指分隔房間的)間隔物、屏風」
165 | * 今日,「把東西分成多塊的人事物」
166 | * .NET 例子
167 | * `System.Windows.Forms.DataGridViewRow.DividerHeight`; 資料表格橫列間
168 | 的間隔高度
169 | * `System.Windows.Forms.DataGridViewColumn.DividerWidth`; 資料表格直列
170 | 間的間隔寬度
171 | * 日常生活例子
172 | * 文字之間的分隔符號,例如空白、空行
173 | * 房間中用來隔間的屏風
174 |
175 | ## 參考資料
176 |
177 | * https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridviewcolumn.dividerwidth?view=netcore-3.1
178 | * https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridviewrow.dividerheight?view=netcore-3.1
179 | * https://en.wikipedia.org/wiki/Word_divider
180 | * https://www.etymonline.com/word/divider
181 | * https://www.lexico.com/en/definition/divider
182 |
183 | ## 其它: Splitter, Break
184 |
185 | * Splitter: 某些 UI 框架會用 splitter 來代表「分割(split)畫面的 UI 元件」
186 | * Break: 斷行(line break), 斷頁(page break)
187 | * HTML 的 `
` 標籤
188 |
189 | ## 參考資料
190 |
191 | * https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap
192 | * https://en.wikipedia.org/wiki/Newline
193 | * https://en.wikipedia.org/wiki/Page_break
194 | * https://html.spec.whatwg.org/#the-br-element
195 |
196 | ---
197 | # 結語
198 |
199 | 適當的命名可以幫助你的讀者了解你的程式碼的意圖,降低溝通成本,減少誤會的
200 | 機率。
201 |
202 | 這系列文章將繼續從語源資料、實用性的角度,探討《程式英文》字彙的語意、使
203 | 用情景,幫助大家提昇程式碼的可讀性。
204 |
205 | 歡迎推文留言討論、提問 :)
206 |
207 | ```
208 | --
209 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
210 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1601003622.A.9E4.html
211 | ```
212 |
--------------------------------------------------------------------------------
/notes/2020-09-11-size.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「集合名詞」數量變數?
5 | 時間 Fri Sep 11 15:52:52 2020
6 | ```
7 |
8 | 本週主題
9 |
10 | * 如何命名「集合名詞」數量變數?
11 | * 「集合名詞」「整體」數量變數
12 | * 「集合名詞」「成員個體」數量變數
13 | * 如何命名「回傳值」?
14 | * 能不能用 books 代表書本數量?
15 |
16 | * Google 簡報 https://bit.ly/3m9PWDZ
17 | * GitHub 討論 https://bit.ly/321ResR
18 |
19 | ---
20 | # 如何命名「集合名詞(collective noun)數量變數」?
21 |
22 | 「集合名詞」是個很有趣的觀念,隨著使用情景不同,集合名詞表達的「整體、個
23 | 體」語意也不同,而美式、英式英文對於集合名詞的文法也不同,使得情況更為複
24 | 雜;這裡我們將聚焦在「集合名詞數量變數」上,
25 |
26 | ## 以 team 這個字為例
27 |
28 | * 團隊
29 | * team
30 | * teams (複數)
31 | * 團隊數 ← 有多少支隊伍
32 | * teamCount
33 | * numberOfTeams
34 | * 團隊大小 ← 某特定隊伍裡有多少成員
35 | * teamSize
36 | * teamMemberCount
37 | * numberOfTeamMembers
38 |
39 | ## 以 fleet 這個字為例
40 |
41 | * 艦隊
42 | * fleet
43 | * fleets (複數)
44 | * 艦隊數 ← 有多少支艦隊
45 | * fleetCount
46 | * fleetQuantity
47 | * numberOfFleets
48 | * 艦隊大小 ← 某特定艦隊裡有多少船
49 | * fleetSize
50 | * fleetShipCount
51 | * fleetShipQuantity
52 | * numberOfFleetShips
53 |
54 | 易言之,當把「集合名詞」視為「一體」時,多半可以沿用之前提過的「數量變數
55 | 」命名法則 ( https://bit.ly/3elcZGT ) 。
56 |
57 | 要數「集合名詞」中的「成員個體」時,多半可以用 Size 這個字來代表「成員個
58 | 體數」,例如:
59 |
60 | * team + size → teamSize
61 | * fleet + size → fleetSize
62 |
63 | 或著,也可以把「數量變數」命名法則應用在「集合名詞 + 成員個體名詞」上,
64 | 例如:
65 |
66 | * team + member + count → teamMemberCount
67 | * fleet + ship + quantity → fleetShipQuantity
68 |
69 | ## 參考資料
70 |
71 | * https://en.wikipedia.org/wiki/Collective_noun#Agreement_in_different_forms_of_English
72 | * https://en.wikipedia.org/wiki/American_and_British_English_grammatical_differences#Subject-verb_agreement
73 | * https://bit.ly/3elcZGT 如何命名「數量變數」
74 |
75 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/6 討論的
76 | 網友。
77 |
78 | ---
79 | # 如何命名「回傳值」?
80 |
81 | 以下提供兩個參考選項。
82 |
83 | ## ret
84 |
85 | * 在 1979 年 Intel 8086 的指令集中就有 RET 指令;代表「從程序返回」
86 | ( "Return from procedure" )
87 | * 延伸版本
88 | * returnValue
89 | * retVal
90 |
91 | ## result
92 |
93 | * 在 ASP.NET 框架裡,以 IActionResult 等類別代表回傳值
94 | * 特定語意情景的「結果」
95 | * 例如: 答案 answer; (總)和 sum, total; 差 difference; 積 product;
96 | 商 quotient; 平均 mean, average
97 | * 或著,在像是 `GetStorageQuota()` 這樣的方法中,傳回 `quota`
98 | * 在 `GetBookTitle()` 這樣的方法中,傳回 `title`
99 |
100 | ## 參考資料
101 |
102 | * https://en.wikipedia.org/wiki/X86_instruction_listings
103 | * https://docs.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-3.1
104 | * https://bit.ly/3a1lDcO ;第 7 頁,「讀者提問:總和 sum vs. total」
105 |
106 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/3 討論
107 | 的網友。
108 |
109 | ---
110 | # 能不能用 books 代表書本數量?
111 |
112 | "books" 在語意上是「一堆書 / 不只一本書 / 書的集合(collection) 」。
113 |
114 | 我傾向於用以下方式表達「書本數量」,語意會更清楚。
115 |
116 | * bookCount
117 | * bookQuantity
118 | * numberOfBooks
119 |
120 | ## 參考資料
121 |
122 | * https://bit.ly/3elcZGT 如何命名「數量變數」
123 |
124 | 感謝參考 https://github.com/EngTW/English-for-Programmers/issues/15 及原
125 | 臉書討論串的網友。
126 |
127 | ---
128 | # 結語
129 |
130 | 適當的命名可以幫助你的讀者了解你的程式碼的意圖,降低溝通成本,減少誤會的
131 | 機率。
132 |
133 | 歡迎推文留言討論、提問 :)
134 |
135 | ```
136 | --
137 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
138 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1599810784.A.DE2.html
139 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/11/2020 15:53:54
140 | → eva19452002: 光是變數命名就可以出一本書來討論了,也真的有出書 09/11 16:04
141 |
142 | 十分同意;有不少很棒的資料、前人留下的智慧結晶,論述「命名」的各種原則與
143 | 優點。
144 |
145 | 我希望這系列的文章能提供「方法、工具、零件、指引」,能幫助母語非英文的讀
146 | 者更近一步去掌握那些前人留下的智慧結晶。 :)
147 |
148 | 推 summerleaves: 優文 09/11 16:22
149 | 推 DCTmaybe: push 09/11 16:26
150 | → Domos: 不可數名詞呢?如data, info 09/11 17:46
151 |
152 | 很有趣的問題,請看下面的回文。 :)
153 |
154 | 推 Tiguru: 推 09/11 18:17
155 | 推 goldie: 優文,推 09/11 22:04
156 | 推 Ouranos: 推推! 謝謝分享~ 09/11 23:09
157 |
158 | 謝謝各位的欣賞 :)
159 |
160 | ---
161 | > → Domos: 不可數名詞呢?如data, info
162 | 推 BlazarArc: 推 這種真的頭很痛 像上面說的 data 複數 XD 09/12 03:09
163 |
164 | 以 data 為例,我想到兩種情形:
165 |
166 | # "data" 另有其物
167 |
168 | 例如說
169 |
170 | * dataFile 資料檔案
171 | * dataPoint 資料點
172 | * dataStream 資料流
173 |
174 | 而 file, point, stream 可以用 "count" 來數,就變成
175 |
176 | * dataFileCount ← 有多少個資料檔案
177 | * dataPointCount ← 有多少個資料點
178 | * dataStreamCount ← 有多少個資料流
179 |
180 | 還可以有其它的 "data" 物件,例如
181 |
182 | * dataEntry 資料條目
183 | * dataCell 資料格
184 |
185 | 等等。
186 |
187 | # 視 "data" 為一個整體
188 |
189 | 那就可能是
190 |
191 | * dataLength 資料長度 (暗示著這資料是像是 array, list 這樣的結構)
192 | * dataSize 資料大小 (佔據的儲存空間)
193 |
194 | 也可以寫成
195 |
196 | * dataInMegabytes 以 MB 計的資料量
197 |
198 | ---
199 | 如果有其它的情形,請讓我知道,我來看看要怎麼用英文表達出來 :)
200 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/12/2020 04:02:24
201 | → eva19452002: 請問大大你怎麼看微軟所推出的匈牙利命名法? 09/12 07:50
202 |
203 | 我的看法是,「匈牙利命名法」是一種工具;每種工具有適合它的舞台、時空背景
204 | 。
205 |
206 | 若回到 1970, 1980 年代,我可以想像匈牙利命名法有它的好處。
207 |
208 | 來到 2020 年代,我會覺得我們有比匈牙利命名法更方便的工具。
209 |
210 | 匈牙利命名法 (又分成系統、應用兩個層面) 在技術上的優缺點,多年來已經累積
211 | 了相當透徹的討論,可以參考這個:
212 |
213 | * https://zh.wikipedia.org/zh-tw/%E5%8C%88%E7%89%99%E5%88%A9%E5%91%BD%E5%90%8D%E6%B3%95
214 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/12/2020 18:54:10
215 | 推 FRAXIS: 那 vector of vector, set of set 要怎麼命名? 09/12 21:59
216 |
217 | 很有趣的問題,請看下面的回文
218 |
219 | 推 jasonwung: 推 09/12 22:20
220 | 推 TWkobe: 推 很實用 09/13 00:08
221 |
222 | 謝謝 :)
223 |
224 | ---
225 | > 推 FRAXIS: 那 vector of vector, set of set 要怎麼命名?
226 | 推 wulouise: nested verctor or set...不要寫這種資料結構 09/13 09:23
227 | 推 wulouise: 應該用alias/typedef把內層定義有意義的名稱,比方vecto 09/13 09:28
228 | → wulouise: r定義成polygon, vector 09/13 09:28
229 |
230 | wulouise 給了很棒的例子,幫它排版一下:
231 |
232 | * vector>
233 | * vector
234 |
235 | 我是從這兩個方向去想:
236 |
237 | * 「就這個程式的情境而言,什麼是實用的、有意義的?」
238 | * 「如何與讀者大腦中既有的知識連結?」
239 |
240 | 例如說,假設現在是在測試「編譯器處理泛型的功能」,那麼,
241 |
242 | * setOfSets
243 | * setsInSet
244 |
245 | 這樣的名字就因為這個情境而實用、有意義;讀者大概也看得懂。
246 |
247 | 假設現在在寫 3D 影像相關的東西,那麼,
248 |
249 | * vectorOfPointVectors
250 | * PointVectorVectors
251 |
252 | 大概就沒有
253 |
254 | * vector polygons
255 | * vector polygonVector
256 |
257 | 來得好。
258 |
259 | 易言之,我會這樣想:若能把情境也納入考量,會對命名更有幫助 :)
260 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/13/2020 10:28:26
261 | 推 wulouise: 感謝原po xd 建議不要有多層資料結構 除非就是x維矩陣 09/13 16:08
262 |
263 | 不客氣 XD
264 |
265 | > 建議不要有多層資料結構 除非就是x維矩陣
266 |
267 | 這讓我想到,我有次需要做到「把一個字串對應到多個字串」,例如,
268 |
269 | * 輸入 "app"
270 | * 輸出 "apple, application, apply"
271 |
272 | 我就用了個 `HashSet>` 的資料結構,像這樣
273 |
274 | * HashSet> wordMappings
275 |
276 | 現在想想,的確可以運用 type aliasing 把程式碼改成像是這樣:
277 |
278 | * HashSet wordMappings
279 | * HashSet wordMappings
280 |
281 | 很有趣的方向,我要再仔細想想 :)
282 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/13/2020 20:18:24
283 | ```
284 |
--------------------------------------------------------------------------------
/notes/2020-09-18-attribute-property.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 「屬性」該用哪個字?
5 | 時間 Fri Sep 18 11:43:53 2020
6 | ```
7 |
8 | 本週主題
9 |
10 | * 「屬性」該用哪個字?
11 | * Attribute, Property 有什麼不一樣?
12 |
13 | 結論:沒有一定的標準。
14 |
15 | * 在哲理上
16 | * 「由外部因素賦予此物件的屬性」,所謂 extrinsic property
17 | * 稱為 property, 也可稱為 attribute
18 | * 「此物件內在本質的屬性」,所謂 intrinsic property
19 | * 稱為 property
20 | * 在語源上
21 | * attribute 偏向「賦予」;「由外部因素賦予此物件的屬性」
22 | * property 偏向「本質」;「此物件內在本質的屬性」
23 | * 在程式實作上,沒有一定的標準。
24 | * 下面列舉了 C#, HTML, DOM 的例子。
25 |
26 | ---
27 | * GitHub 討論 https://bit.ly/321ResR
28 | * Google 簡報 https://bit.ly/32DAoAD
29 |
30 | ---
31 | # Attribute, Property 有什麼不一樣?
32 |
33 | * 在哲理上
34 | * 「由外部因素賦予此物件的屬性」,所謂 extrinsic property
35 | * 稱為 property, 也可稱為 attribute
36 | * 「此物件內在本質的屬性」,所謂 intrinsic property
37 | * 稱為 property
38 | * 在語源上
39 | * attribute 偏向「賦予」;「由外部因素賦予此物件的屬性」
40 | * property 偏向「本質」;「此物件內在本質的屬性」
41 |
42 | ## Attribute
43 |
44 | * 語意:外部(extrinsic) / 關係(relational) 屬性
45 | * 由「與其它物件的關係」賦予此物件的屬性
46 | * 例如,一個物件的「重量」;由此物件所處的重力場賦予的屬性
47 | * 語源: 14 世紀後期,動詞「賦予、指派」,名詞「對某人的評價」
48 | * 在程式上
49 | * 可表達物件、元素的屬性
50 | * 常用來表達「屬性的屬性」
51 |
52 | ## Property
53 |
54 | * 語意
55 | * 內部(intrinsic) 屬性
56 | * 物件本質上的屬性
57 | * 例如,一個物件的「質量」
58 | * 也可以代表 外部(extrinsic) / 關係(relational) 屬性
59 | * 語源: 1300 年代,本質、特性
60 | * 在程式上
61 | * 可表達物件、元素的屬性
62 |
63 | # Attribute, Property 該用哪個字?
64 |
65 | 在程式實作上,不同語言、框架、環境對於「物件屬性」這個觀念的心智模型多少
66 | 有出入,並沒有一定的標準。
67 |
68 | 我個人偏好 C# 的風格。
69 |
70 | ## 以 C# 為例
71 |
72 | * 在「為東西加註資料(metadata)」的情景下,用 `Attribute`
73 | * 例如, `DebuggerBrowsableAttribute`
74 |
75 | * 而「類別的屬性」,稱為 `Property`
76 | * 例如, `String.Length`
77 |
78 | ## 以 HTML / DOM 為例
79 |
80 | HTML (attribute) / DOM (property) 則是用了不同的字來表達「東西的屬性」。
81 |
82 | 引用 https://stackoverflow.com/a/53924373 的例子:
83 |
84 | ```
85 |
86 | ```
87 |
88 | * 假設使用者在此輸入欄位填上了 "foo"
89 |
90 | * 接下來以 `` 代表此 HTML 元素(element)
91 |
92 | * 接下來以 `theInput` 代表此 DOM 物件
93 |
94 | * 執行 theInput.value 會得到 "foo"
95 | * value 是 theInput 這個 DOM 物件的 property (屬性)
96 |
97 | * 執行 theInput.getAttribute('value') 會得到 "Name:"
98 | * `getAttribute()` 是 theInput 這個 DOM 物件的方法
99 | * value 是 `` 這個 HTML 元素的 attribute (屬性)
100 |
101 | ## 參考資料
102 |
103 | * https://en.wikipedia.org/wiki/Attribute_(computing)
104 | * https://en.wikipedia.org/wiki/Property_(philosophy)#Intrinsic_and_extrinsic_properties
105 | * https://stackoverflow.com/a/53924373
106 | * https://www.etymonline.com/word/attribute
107 | * https://www.etymonline.com/word/property
108 | * https://www.lexico.com/en/definition/attribute
109 | * https://www.lexico.com/en/definition/property
110 |
111 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/25 討論
112 | 的網友。
113 |
114 | ---
115 | 這週比較忙,只研究了一個題目。 XD
116 |
117 | ```
118 | --
119 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
120 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1600400643.A.D04.html
121 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 11:44:41
122 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 11:46:46
123 | → yoche2000: 推 09/18 12:06
124 | 推 hans1461: 推 09/18 12:08
125 |
126 | 謝謝 :)
127 |
128 | → chatnoir: vue跟react都用props傳參數給child耶, 我要去發PR XDDD 09/18 12:17
129 |
130 | 我不熟 vue, react 及其架構理念;能不能談談你是為什麼想去發什麼樣的 PR ? :)
131 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 12:25:38
132 | → krazy1101: React 的 props 官方文件表示 properties 的縮寫,但 09/18 12:29
133 | → krazy1101: 行為比較像是從外部傳值進入元件,剛好跟你寫的定義相 09/18 12:29
134 | → krazy1101: 反 09/18 12:29
135 |
136 | 謝謝你的說明 :)
137 |
138 | 這讓我想到 C# 語言中,類別(class)的 "property" 也是支援 setter/getter 。
139 |
140 | 或許這要看這些語言、框架的設計者有沒有留下紀錄它當初思路、考量的文件,才
141 | 能知道它為什麼要這樣設計、選用特定的字。
142 |
143 | 推 easterday: 我也覺得attribute->內在,property->外在 09/18 12:40
144 | → easterday: 這樣的用法比較多 09/18 12:41
145 |
146 | (延續上面的討論)
147 |
148 | 或許可以這樣想:
149 |
150 | * 在哲理思維層級,
151 |
152 | * 東西有質量(mass);質量是東西的 內部(intrinsic) 屬性(property)
153 | * 東西存在,就有質量;質量不受外部因素影響
154 |
155 | * 東西有重量(weight);重量是東西的 外部(extrinsic) 屬性(attribute)
156 | * 東西有重量,是因為「這個東西」與「這環境的重力場」的關係
157 | * 東西的重量受外部因素「重力場」的影響
158 |
159 | * 在程式實作層級,可能是寫成這樣:
160 | ```
161 |
162 | ```C#
163 | class Thing
164 | {
165 | public double MassInGrams { get; set; }
166 | public double WeightInGrams { get; set; }
167 | }
168 | ```
169 |
170 | ```
171 | 從 C# 語言層級來看, `MassInGrams`, `WeightInGrams` 都是 `Thing` 這個
172 | 類別(class)的屬性(property)。
173 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 13:32:10
174 | 推 virdust2003: 認同這篇 09/18 13:18
175 |
176 | 謝謝你的欣賞 :)
177 |
178 | ---
179 | (延續上面的討論)
180 |
181 | 我修改了上面的原文
182 |
183 | # 舊
184 |
185 | * 語意:內部(intrinsic) 屬性
186 | * 物件本質上的屬性
187 | * 例如,一個物件的「質量」
188 |
189 | # 新
190 |
191 | * 語意
192 | * 內部(intrinsic) 屬性
193 | * 物件本質上的屬性
194 | * 例如,一個物件的「質量」
195 | * 也可以代表 外部(extrinsic) / 關係(relational) 屬性
196 |
197 |
198 | # 參考資料
199 |
200 | * https://en.wikipedia.org/wiki/Property_(philosophy)#Intrinsic_and_extrinsic_properties
201 |
202 | > An intrinsic property is a property that an object or a thing has of
203 | > itself, independently of other things, including its context.
204 |
205 | > An extrinsic (or relational) property is a property that depends on a
206 | > thing's relationship with other things.
207 |
208 | > The latter is sometimes also called an attribute, since the value of
209 | > that property is given to the object via its relation with another
210 | > object.
211 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 13:49:45
212 | 推 chatnoir: 感謝k大幫我解釋 ~ 我只是開玩笑的 09/18 14:19
213 |
214 | 我覺得那是很有意思的題目,也讓我發現了我的文章最原始的版本寫得不夠清楚;
215 | 希望推文中的後續討論、補充說明有幫助 :)
216 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 14:37:57
217 | → ChungLi5566: 對岸是翻成固有屬性跟自定義屬性 09/18 14:47
218 |
219 | 謝謝補充資訊 :)
220 |
221 | 推 DCTmaybe: 請問有argument,parameter系列嗎? 09/18 15:08
222 |
223 | 有,可以參考
224 |
225 | * https://www.ptt.cc/bbs/Soft_Job/M.1597982849.A.9A7.html
226 | * 或 Google 簡報 https://bit.ly/3l161ey 第 17 頁
227 |
228 | ---
229 | 這系列文章的列表: https://github.com/EngTW/English-for-Programmers
230 |
231 | 也有列出每個文章的主要關鍵字,可以用 CTRL-F 找你想查的字。
232 |
233 | 推 CoNsTaR: argument, parameter 問題出在中文沒有適合的詞來翻 argu 09/18 17:07
234 | → CoNsTaR: ment,所以只好都叫參數吧... 09/18 17:07
235 | → Jockey66666: argument(引數) parameter(參數) 蠻多這樣翻的吧 09/18 20:08
236 |
237 | 是的,我查到的也是這樣翻:
238 |
239 | * 方法、函數宣告的是參數 (parameter)
240 | * 傳入方法、函數的是引數 (argument)
241 |
242 | 推 LERICAL: 推 09/18 20:38
243 |
244 | 謝謝 :)
245 |
246 | ---
247 | 文章編輯說明;希望這樣子能更清楚 :)
248 |
249 | # 舊:「哲理、語意」混在一起
250 |
251 | * 在哲理、語意上
252 | * attribute 偏向「由外部因素賦予此物件的屬性」
253 | * property 偏向「此物件內在本質的屬性」
254 |
255 | # 新:「哲理、語意」分開來說
256 |
257 | * 在哲理上
258 | * 「由外部因素賦予此物件的屬性」,所謂 extrinsic property
259 | * 稱為 property, 也可稱為 attribute
260 | * 「此物件內在本質的屬性」,所謂 intrinsic property
261 | * 稱為 property
262 | * 在語源上
263 | * attribute 偏向「賦予」;「由外部因素賦予此物件的屬性」
264 | * property 偏向「本質」;「此物件內在本質的屬性」
265 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 21:25:21
266 | → KanzakiHAria: C++attribute從外面給屬性 vcproj property是本質 09/21 21:16
267 |
268 | 感謝提供實例 :)
269 |
270 | 推 candycan: 講到「屬性」就會想到「設定」,好像很容易搞混… 09/22 12:56
271 |
272 | 是的。
273 |
274 | 在臉書那邊的討論有個很有意思的題目:「要怎麼表達『傑尼龜的屬性是水』?」
275 |
276 | 這時候就要分析「屬性」想表達的 語意 究竟為何 。
277 |
278 | 最後整理出來,比較完整的說法是
279 |
280 | * "PokemonPowerType" 是「傑尼龜的屬性 (之一)」
281 | * 傑尼龜的 Pokemon Power Type 是水。
282 |
283 | 那就可以視上下文脈絡,可以有像是以下的選擇:
284 |
285 | * 傑尼龜.PokemonPowerType = Water
286 | * 傑尼龜.PowerType = Water
287 | * 傑尼龜.Type = Water
288 |
289 | 推 bug2: 謝謝分享 很有價值的討論與實用範例 09/25 10:18
290 |
291 | 謝謝 :) 有任何問題、建議,歡迎提出來討論 :)
292 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/25/2020 11:38:04
293 | ```
294 |
--------------------------------------------------------------------------------
/notes/2020-08-28-copy-clone-duplicate.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「複製」功能
5 | 時間 Fri Aug 28 11:52:49 2020
6 | ```
7 |
8 | 這週的主題是「複製」: Copy, Clone, Duplicate 。
9 |
10 | 我們將從語源學的角度來分析 copy, clone, duplicate 的「複製」語意差別,辨
11 | 別什麼情況適合用哪個字。
12 |
13 | * Google 簡報 https://bit.ly/3guPFaE
14 | * GitHub 討論 https://bit.ly/321ResR
15 |
16 | ---
17 | # Copy
18 |
19 | copy 起源於 14 世紀後期,原意是「抄寫複製文字/文件」;在 1950 年代開始用
20 | 來描述「複製電腦資料」,到今日「電腦資料」包含了從文字到影音的各種數位化
21 | 資料、檔案。
22 |
23 | ## 語源
24 |
25 | * 14 世紀後期:抄寫、複製文字/文件
26 | * 1640 年代:模仿
27 | * 1953 :複製電腦資料
28 | * 1983 :送一份 文件/信/email 給第三方
29 |
30 | ## 案例
31 |
32 | * 複製電腦檔案/資料
33 | * 網頁內容(文字、圖片、影音)
34 | * .NET `File.Copy()`
35 | * 影印機(copy machine)
36 | * 複製保護(copy protection)
37 | * 著作權(copyright)
38 |
39 | ## 參考資料
40 |
41 | * https://www.etymonline.com/word/copy
42 | * https://www.lexico.com/definition/copy
43 | * https://en.wikipedia.org/wiki/Copy
44 |
45 | ---
46 | # Clone
47 |
48 | clone 是相對近代( 1903 年)才出現的字,原意是「一群從母體分支移植培育的
49 | 植物」,在 1970 年代開始被用來描述「在遺傳基因層級複製人/動物」的觀念,
50 | 例如 1973 年的電影《The Clones》,即是以「複製人」為劇情設定。
51 |
52 | 目前沒有足夠資料來推論 clone 這個字是怎麼轉移到電腦領域的,我能找到的最
53 | 早的紀錄是 Linux 1.0.0 版(於 1994 年 3 月釋出)有 `clone` system call 。
54 |
55 | ## 語源
56 |
57 | * 1903 :(植物學)一群從母體分支移植培育的植物
58 | * 1959 :開始被當作動詞使用
59 | * 1970 :由單個細胞開始、在遺傳基因層級複製人/動物
60 | * 1994 : Linux 1.0.0 system call `clone(2)`
61 |
62 | ## 案例
63 |
64 | * Git `clone`
65 | * Linux system call `clone(2)`
66 | * Java Object `clone()`
67 | * .NET ICloneable `clone()`
68 | * 複製品
69 | * Diablo clone 類/仿 Diablo 的遊戲
70 | * Facebook clone 類/仿 Facebook 的網站
71 |
72 | ## 參考資料
73 |
74 | * https://www.etymonline.com/word/clone
75 | * https://www.lexico.com/definition/clone
76 | * https://en.wikipedia.org/wiki/Clone
77 | * https://en.wikipedia.org/wiki/Fork_(system_call)#Clone
78 | * https://man7.org/linux/man-pages/man2/syscalls.2.html
79 | * https://www.imdb.com/title/tt0071336/
80 |
81 | ---
82 | # Duplicate
83 |
84 | duplicate 起源於 15 世紀,形容「雙份的」,作為動詞「把東西複製成雙份」,
85 | 或是指「(之於某物)一模一樣的東西」。
86 |
87 | ## 語源
88 |
89 | * 15 世紀早期:雙份的
90 | * 15 世紀晚期:複製成雙份
91 | * 1530 :(之於某物)一模一樣的東西
92 |
93 | ## 案例
94 |
95 | * .NET Linq `DuplicateKeyException`
96 | * 代碼重複/複製 duplicate code
97 | * 遊戲中複製物品 dupe / duping
98 |
99 | ## 參考資料
100 |
101 | * https://www.lexico.com/definition/duplicate
102 | * https://www.etymonline.com/word/duplicate
103 | * https://en.wikipedia.org/wiki/Duplication
104 | * https://en.wikipedia.org/wiki/Duplicate_code
105 | * https://en.wikipedia.org/wiki/Duping_(video_games)
106 |
107 | ---
108 | # Copy, Clone, Duplicate 有什麼不一樣?
109 |
110 | 作為動詞時, copy, clone, duplicate 都能讓讀者聯想到「複製」這個觀念,就
111 | 看你想強調「複製」的哪一個面向。
112 |
113 | 比較特別的是 duplicate 做為形容詞「雙份的」時,則是 copy, clone 無法替換
114 | 的;例如下列的 `DuplicateKeyException` 。
115 |
116 | * 「抄錄資料」 → copy
117 | * .NET File.Copy() 複製檔案1的內容到檔案2
118 | * .NET Array.Copy() 複製陣列1的元素到陣列2
119 | * .NET List.CopyTo() 複製此串列的元素到串列2
120 |
121 | * 「個體繁殖」 → clone
122 | * Git clone 複製 Git repo
123 | * .NET Object.MemberwiseClone() 淺 (shallow) 複製此物件
124 |
125 | * 「雙份的;製造雙份」 → duplicate
126 | * .NET Linq DuplicateKeyException 「同樣的物件 key 已存在」例外
127 | * Office Shape.Duplicate() 複製一形狀 (shape) 物件為雙份
128 |
129 | ## 參考資料
130 |
131 | *
132 | https://docs.microsoft.com/en-us/dotnet/api/system.io.file.copy?view=netcore-3.1
133 | *
134 | https://docs.microsoft.com/en-us/dotnet/api/system.array.copy?view=netcore-3.1
135 | *
136 | https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.copyto?view=netcore-3.1
137 | * https://git-scm.com/docs/git-clone
138 | *
139 | https://docs.microsoft.com/en-us/dotnet/api/system.object.memberwiseclone?view=netcore-3.1
140 | *
141 | https://docs.microsoft.com/en-us/dotnet/api/system.data.linq.duplicatekeyexception?view=netframework-4.8
142 | *
143 | https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.core.shape.duplicate?view=office-pia
144 |
145 | ---
146 | # 「複製」深淺度、連動關係
147 |
148 | copy, clone, duplicate 並沒有明確統一的實作慣例。
149 |
150 | 每套框架可能有它自己的實作風格。
151 |
152 | * 深 (deep) 複製 / 淺 (shallow) 複製
153 | * 本體 與 複製體 之間是否有連動關係
154 |
155 | ---
156 | # 結語
157 |
158 | 有「複製」語意的字彙不只 copy, clone, duplicate 這三個,但從 GitHub 及
159 | Microsoft doc 取樣的結果來看, copy, clone, duplicate 在程式碼中的出現頻
160 | 率比其它「複製」字彙(例如 replicate, mirror, repeat )來得高,所以先研
161 | 究這三個字。
162 |
163 | 非常感謝參與 https://github.com/EngTW/English-for-Programmers/issues/17
164 | 討論的網友。
165 |
166 | 有任何疑問、建議、感想,歡迎推文留言討論。 :)
167 |
168 | ---
169 | # 徵求意見回饋
170 |
171 | 本週簡報有兩個版本:
172 |
173 | * 正式發布版: https://bit.ly/3guPFaE (含講者稿)
174 | * 實驗版: https://bit.ly/31yi5w4 (含講者稿)
175 |
176 | 如果方便的話,請告訴我你對這兩種版本/寫作取向的感覺,謝謝 :)
177 |
178 | ```
179 | --
180 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
181 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1598586794.A.F2D.html
182 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/28/2020 11:56:01
183 | 推 CaptPlanet: 推 08/28 12:38
184 | 推 Aobanan: 推 08/28 12:38
185 | 推 hans1461: 推 08/28 13:47
186 | 推 ga4567896: 推 08/28 13:56
187 | 推 DCTmaybe: 想請問php references的這種情況 $a=&$b; 適合用哪個字? 08/28 14:23
188 | 推 lazyfirst: 實驗版和正式發布版的寫作口氣差好多,是大大寫的嗎? 08/28 14:46
189 | 推 sniper2824: 推 08/28 17:37
190 | 推 summerleaves: 推文推 08/28 17:59
191 | → summerleaves: 優** 08/28 17:59
192 | 推 alihue: 推 08/28 18:08
193 | 推 Ouranos: Amos 必推! 08/28 21:43
194 | 推 wulouise: reference是參照不是複製吧 08/28 22:01
195 | 推 alihue: 正式版編排比較讀得下去,有別人用法的實務範例好懂很多 08/28 22:12
196 | → alihue: 工程師比較不喜歡那麼多廢話 想看重點XD 08/28 22:12
197 | 推 DCTmaybe: 好像也是,算了當我沒問XD 08/28 22:14
198 | 推 brianhsu: 這裡提到的複製應該比較像真的有兩個不同的記憶體區塊但 08/28 23:22
199 | → brianhsu: 內容相同,單純的兩個 pointer / reference 指到同一個 08/28 23:22
200 | → brianhsu: 物件好像不太會用這些詞。 08/28 23:22
201 | 推 jasonwung: 推 08/29 00:18
202 |
203 | 謝謝各位的欣賞 :)
204 |
205 | ---
206 | > 推 DCTmaybe: 想請問php references的這種情況 $a=&$b; 適合用哪個字?
207 | > 推 wulouise: reference是參照不是複製吧
208 | > 推 brianhsu: 這裡提到的複製應該比較像真的有兩個不同的記憶體區塊但
209 | > → brianhsu: 內容相同,單純的兩個 pointer / reference 指到同一個
210 | > → brianhsu: 物件好像不太會用這些詞。
211 |
212 | 我會從「想聚焦在哪個場景」這個角度來看,例如說,
213 |
214 | * 從 `=` 這個 "assignment operator" (指派運算子) 的層級來看,我會用
215 | "assign" 這個動詞。
216 |
217 | * 往實作細節去看的話,我想一定會有以下的動作:「讀取 $b 的 reference 的
218 | 『值』,將其寫入 $a 的儲存空間」;在描述如此「抄寫一個『值』」的動作時
219 | ,我會用 copy 這個動詞。
220 |
221 | * 如果是要強調「已經有了 $b, 現在再多產生一個相等的 $a 」,那我會用
222 | duplicate 這個動詞。
223 |
224 | 而 duplicate 的語意可以是正面也可以是負面,例如說,
225 |
226 | * 我們 duplicate 了 $b, 所以接下來當 $b 消失、被更動,我們還有 $a 可以
227 | 用 ← 在此 duplicate 就是偏向正面的「備份、備援」
228 |
229 | * 我們 duplicate 了 $b, 但後來發現這樣做沒什麼正面效益,可能還多了一個
230 | 變數 $a 要多花心力維護 ← 在此 duplicate 就是偏向負面的「冗贅」
231 |
232 | 也就是說, duplicate 比 assign, copy, clone 更能帶出「雙份 / 不止一份」
233 | 的語意。
234 |
235 | ---
236 | > 推 lazyfirst: 實驗版和正式發布版的寫作口氣差好多,是大大寫的嗎?
237 |
238 | 不是 :) 但的確是我想要做的實驗,試著找到「簡潔, 好懂, 平易近人」的平衡,
239 | 還有不同媒體 (文字、影音) 適合的內容走向。
240 |
241 | > 推 alihue: 正式版編排比較讀得下去,有別人用法的實務範例好懂很多
242 | > → alihue: 工程師比較不喜歡那麼多廢話 想看重點XD
243 |
244 | 十分感謝你的意見回饋 orz 我能體會那種感覺,想要「高密度、以一貫之的實用
245 | 資訊」 :D
246 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/29/2020 07:28:47
247 | 推 unmolk: 推實用!學生受益良多 08/29 09:52
248 |
249 | 謝謝你的欣賞 :)
250 |
251 | 推 Csongs: 個人喜歡語源學來了解英文語系的思路,以前學英文字根多少 08/29 11:53
252 | → Csongs: 就有這個意味 08/29 11:53
253 |
254 | 十分同意;接觸語源學的資料後,之前一些自己也說不明白的「語感」,也開始變
255 | 得更明白。
256 |
257 | 推 DCTmaybe: 感謝說明~推推 08/29 21:24
258 |
259 | 不客氣 :)
260 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/30/2020 02:36:13
261 | 推 BlazarArc: 推 09/01 09:16
262 | 推 kyukyu: 09/03 12:12
263 |
264 | 謝謝 :)
265 |
266 | 推 APTON: 謝謝!GIT按星星並追蹤了 09/03 12:55
267 | → APTON: 以後有人故意要戰命名就叫他先看完這個系列!XD 09/03 12:56
268 |
269 | 謝謝你的欣賞 :)
270 |
271 | 我猜想,有時候「戰命名」可能就只是每個人心智/邏輯/思維模型不同,抽象層的
272 | 分界點不一。
273 |
274 | 這系列文章是儘量建構於客觀參考資料、應用實例之上,希望能降低因主觀語感而
275 | 起爭議的機率。 :D
276 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/04/2020 12:12:50
277 | 推 janbarry168: 推 09/05 09:59
278 |
279 | 謝謝 :)
280 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/06/2020 08:00:45
281 | ```
282 |
--------------------------------------------------------------------------------
/notes/2020-07-24-type-kind-category.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「種類」
5 | 時間 Fri Jul 24 13:12:28 2020
6 | ```
7 |
8 | 有時候,我們會依照人事物的性質、特徵做「分組(group) 、標記(tag) 」。
9 |
10 | 像是:
11 |
12 | * 把房間裡的雜物分類成書籍、服飾、器具。
13 | * 把書分類成小說、漫畫、工具書。
14 | * 把小說分類成愛情、歷史、奇幻、科幻。
15 |
16 | 那麼,該怎麼用英文描述那個「分組的種類、類別、類型」?
17 |
18 | # 先說結論: "category" 可說是最萬用的選擇。
19 |
20 | 這篇文章會深入探討 type / class / category / classification 的語意,希望
21 | 能幫助讀者學會用英文提昇程式可讀性。
22 |
23 | * Google 簡報 https://bit.ly/2OOSpEs
24 | * Facebook 相簿 https://bit.ly/3ju7sBz
25 | * GitHub 討論 https://bit.ly/321ResR
26 |
27 | ---
28 | # 如何命名「種類」?
29 |
30 | 「分組、標記」時,中文多半會用「種、類、型」來表達那「分組的組別」。
31 |
32 | 例如:
33 |
34 | 1. 書籍種類 ← 小說、漫畫。
35 | 2. 刊物分類 ← 週刊、月刊、年刊
36 | 3. 遊戲類型 ← 動作、戰略、模擬
37 | 4. 艙等種類 ← 經濟艙、商務艙
38 | 5. 血型 ← A、B、O、AB
39 | 6. 髮型 ← 長髮、短髮
40 | 7. 狗的品種 ← 柴犬、哈士奇
41 |
42 | 讀者可以試試將以上「種、類、型」等字對應到英文字彙(本文最後有參考答案)
43 | 。
44 |
45 | 如果這對你來說很容易,可以到《程式英文》 GitHub 討論區 https://bit.ly/321ResR
46 | 看看有沒有更有趣的題目,或提出你在寫程式時遇到的英文問題;這能幫助我把這
47 | 個知識庫整理得更完善。謝謝 :)
48 |
49 | ---
50 | 隨著情景、領域不同,用來表達「種、類、型」的英文字彙也不同。
51 |
52 | # 情景
53 |
54 | 大致而言,「把人事物分組」有三種目的;它們對應的英文字如下:
55 |
56 | * 區分、隔離 → type / class
57 | * 歸納、整理 → category / subcategory
58 | * 定義、鑑別 → classification / 領域特有字
59 |
60 | # 領域
61 |
62 | 有些領域有它的特有字,比如:
63 |
64 | * 藝術作品(電影、音樂、遊戲) → genre
65 | * 車 → make、 model
66 | * 生物 → 物種(species)、品種(breed)、品系(strain)
67 |
68 | 本文後面會提到如何探索每個領域的特有字。
69 |
70 | ---
71 | # 情景:為了「區分、隔離」而分組
72 |
73 | 例如說:
74 |
75 | * 「世界上有 10 種人:懂二進位的人、不懂二進位的人。」
76 |
77 | 「懂二進位的人」、「不懂二進位的人」都是人,而這裡的語意是想 *區分* 這兩
78 | 種人。
79 |
80 | 在這種情景下,就適合用 type / class 。
81 |
82 | ## Type
83 |
84 | 除了「種、類」, type 還可以對應到「型」。
85 |
86 | 例如:
87 |
88 | * 血型(blood type)
89 | * 統計學上的「第一型錯誤(type I error)」、「第二型錯誤(type II error)」
90 |
91 | ## Class
92 |
93 | class 除了「種類」外,另有「級」(階級、品級)的意思。
94 |
95 | 例如:
96 |
97 | * 頭等艙(first class)
98 | * 中產階級(middle class)
99 |
100 | ---
101 | # 情景:為了「歸納、整理」而分組
102 |
103 | 相對於「為了『區分、隔離』而分組」,有時候就只是單純列舉「種類、組別」;
104 | 例如說:
105 |
106 | * 「書店二樓的書大致上有三類:漫畫、小說、畫冊。」
107 |
108 | 這種情景下就適合用 category ;如果有需要,可以再細分為 subcategory 。
109 |
110 | 例如:
111 |
112 | * 念能力:強化、放出、變化、操作、具現化、特質
113 | * 商品種類
114 | * 在電商網站上常可看到 Category / Categories 等字。
115 | * 參考截圖: https://bit.ly/2OTcQ2M
116 |
117 | ---
118 | # 情景:為了「定義、鑑別」而分組
119 |
120 | 有的時候需要「嚴謹的分組」;例如說:
121 |
122 | * 「汽車駕照有『普通、職業』兩大類,每類再細分為『小型車、大貨車、大客車
123 | 、聯結車』四種。」
124 |
125 | 這時候就適合用 classification ,或著該領域特有字。
126 |
127 | 例如:
128 |
129 | * 期刊類別:週刊、月刊、季刊、年刊
130 | * 出刊頻率(publication frequency)
131 | * 獵人階級:無牌、業餘、初級、一星、二星、三星
132 |
133 | ---
134 | # 那 Sort / Kind 呢?
135 |
136 | ## Sort
137 |
138 | 在電腦科學、軟體工程、程式設計的領域裡,因為 sort 更常與「排序」連結在一
139 | 起,所以不建議再用 sort 來表種「種類」。
140 |
141 | ## Kind
142 |
143 | kind 可以用在「避免與程式語言中既有的 "type" 混淆」的情形。
144 |
145 | 例如 .NET 的 `DateTimeKind` 是用來區分一 DateTime 物件是當地時間,或是
146 | UTC 時間。
147 |
148 | *如果* 被命名為 DateTimeType, 就容易與 "DateTime type" 混淆。
149 |
150 | ---
151 | # 探索「領域特有字」
152 |
153 | ## 參考電商網站
154 |
155 | 從電商網站的商品目錄、搜尋介面可以學到它們是用哪些字表達「種、類」。
156 |
157 | 諸如:
158 |
159 | * https://store.steampowered.com/ 用 genre 來分類遊戲。
160 | * https://www.youtube.com/audiolibrary/music
161 | * 用 genre, mood, instrument (類型、心情、樂器)來分類音樂。
162 | * 用 category 來分類音效。
163 | * https://www.carmax.com/cars
164 | * 用 type 來分類車種(運動型休旅車、卡車、轎車、等等)
165 | * 用 brand / make 來分類品牌
166 | * 用 model 來分類車系
167 | * 用 price 來分類售價範圍
168 | * 用 body style 來分類車型
169 | * 用 year 來分類製造年份
170 |
171 | ## 拜 Google
172 |
173 | 或著,可以這樣拜 Google:
174 |
175 | * how to categorize 名詞
176 | * how to classify 名詞
177 |
178 | 例如 "how to categorize wine" (如何分類酒)傳回的第一個結果:
179 |
180 | * "Classification of wine"
181 | * https://en.wikipedia.org/wiki/Classification_of_wine
182 |
183 | 可以進一步找到更多的關鍵字:
184 |
185 | * place of origin / appellation 產地
186 | * vinification methods and style 釀酒方法
187 | * sweetness 甜度
188 | * vintage 年份
189 |
190 | 另一個例子, "how to classify steak" (如何分類牛排)傳回的第一個結果:
191 |
192 | * Understanding Cuts and Grades of Steak
193 | * https://www.thespruceeats.com/steak-grades-and-cuts-331671
194 |
195 | 可以從該文章找到更多關鍵字,像是牛排的等級(grade)、牛肉的部位(cut) 。
196 |
197 | ---
198 | # 到底什麼時候該用哪一個字?
199 |
200 | "category" 可說是最萬用的選擇。
201 |
202 | 依情景不同,以下是一些參考案例:
203 |
204 | * 卡爾達肖夫指數(Kardashev Scale)
205 | * 「第幾型(type)文明」
206 | * 薩菲爾-辛普森颶風風力等級(Saffir–Simpson hurricane wind scale)
207 | * 「第幾級(category)颶風」
208 | * 船級(Ship class)
209 | * 「船級(class)」
210 | * 「船種(type)」
211 | * 福特級航空母艦(Ford-class aircraft carriers)
212 | * 牛排熟度(Doneness)
213 | * Degree of Doneness
214 | * Level of Cooking
215 |
216 | 如果有不確定的情形,歡迎到《程式英文》 GitHub 討論區 https://bit.ly/321ResR
217 | 提問、討論。
218 |
219 | ---
220 | # 「種、類、型」 vs. 「組、標籤、屬性」
221 |
222 | 前面提到的「種、類、型」英文字彙適合用來與「人」溝通。
223 |
224 | 例如:
225 |
226 | * 電商網站介面 → 與客戶、消費者溝通
227 | * 程式碼 → 與開發團隊成員溝通
228 |
229 | 實務上,程式設計師考量「演算法、資料結構」時,多少會需要把「種、類、型」
230 | 更進一步抽象化成「組、標籤、屬性」。
231 |
232 | 這裡列舉這「抽象化」過程可能會有幫助的英文單字:
233 |
234 | * 組 → Group
235 | * 標籤 → Tag
236 | * 屬性 → Attribute / Property
237 |
238 | ---
239 | 題外話: 「 Attribute 與 Property 有什麼不同?」
240 |
241 | 坦白說,我也不知道 XD
242 |
243 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/25 來追蹤
244 | 這個問題。
245 |
246 | ---
247 | # 結語
248 |
249 | 如果程式用字能接近美式英文當然是好,但不需要給自己太大的壓力,因為每個人
250 | 都是從零開始學起 :)
251 |
252 | 這一系列文件的目的是想幫助讀者縮小中英文之間語感的落差。
253 |
254 | 這篇關於「種類」的文章,是從讀者提問得到的靈感,我自己也學到了很多東西。
255 |
256 | 若你在程式寫作上有遇到「英文表達」的問題,歡迎在這篇文章下留言,或到以下
257 | 網站提問討論。
258 |
259 | * GitHub 討論區 https://bit.ly/321ResR
260 | * Facebook 相簿 https://bit.ly/3ju7sBz
261 | * Twitter 討論 https://bit.ly/2CYKgdZ
262 |
263 | 這可以幫助我把這系列文件整理得更完善,謝謝 :)
264 |
265 | ---
266 | # 其它資訊
267 |
268 | * Google 簡報 https://bit.ly/2OOSpEs
269 |
270 | ## *參考* 答案
271 |
272 | 1. category
273 | 2. classification, publicationFrequency
274 | 3. genre
275 | 4. class
276 | 5. type
277 | 6. style
278 | 7. breed
279 |
280 | ```
281 | --
282 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
283 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1595567563.A.CCF.html
284 | 推 tbpfs: 趕快推~以免被人家知道不懂 07/24 13:17
285 |
286 | XD
287 |
288 | 在寫這篇文章前,其實我對這幾個字的語意差別是一知半解。
289 |
290 | 是從網友提問才發現,這幾個字背後也有它的學問。 :)
291 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/24/2020 13:22:53
292 | 推 alohac: 念能力還蠻恰當的 嘻嘻 07/24 13:51
293 | → testPtt: 我偏要用zhonglei 07/24 14:01
294 |
295 | XD
296 |
297 | 推 yyhsiu: 推,然後樓上我笑了 07/24 15:17
298 | 推 yoche2000: 推念能力 07/24 15:30
299 |
300 | 講到念能力,
301 |
302 | > * 期刊類別:週刊、月刊、季刊、年刊
303 | > * 出刊頻率(publication frequency)
304 |
305 | 「期刊類別」除了「週刊、月刊、季刊、年刊」,應該再加個「火鳳、冨樫」。 XD
306 |
307 | → roccqqck: species如何 07/24 18:26
308 |
309 | 根據字典,看來 "species" 適合用在科學方面,例如
310 |
311 | * 生物物種
312 | * 化學、物理上的原子、分子、離子、粒子的種類
313 |
314 | 推 kevin979: 推,最近公司要統一命名規範,心好累~ 07/24 18:45
315 |
316 | 能理解 :)
317 |
318 | 如果遇到英文相關的問題,歡迎來討論 (或 Facebook, Twitter 私訊也可以) :)
319 |
320 | * GitHub 討論區 https://bit.ly/321ResR
321 | * Facebook 相簿 https://bit.ly/3ju7sBz
322 | * Twitter 討論 https://bit.ly/2CYKgdZ
323 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/24/2020 19:57:55
324 | 推 WestMelon: 優文推 07/24 19:44
325 |
326 | 謝謝 :)
327 |
328 | 推 handsomeburg: 但type / class很大比例是保留字 07/24 19:48
329 |
330 | 十分同意。
331 |
332 | * 有些語言允許使用保留字,例如 C# 可以在保留字前加上 "@", 就可以當一般
333 | identifier 使用;例如 @object
334 | * 有些語言是 case-sensitive, 大寫的 Class 不會被視為 "class" 保留字
335 | * 最後還有一個方法,就是組合字,例如 ShipClass ,來避開保留字
336 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/24/2020 20:06:55
337 | 推 jasonwung: 推 07/24 20:56
338 | 推 CaptPlanet: 讚讚讚 07/24 22:48
339 |
340 | 謝謝 :)
341 |
342 | 推 brianhsu: 另一種是故意換個方式拼,用 clazz 也滿常看到的。 07/25 09:20
343 |
344 | 同意,感謝補充 :)
345 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/25/2020 11:18:00
346 | 推 ian90911: 感謝分享 07/25 14:04
347 | 推 sk6852: 推!感謝分享 07/25 15:19
348 | 推 qaz0101: 推 07/25 17:09
349 |
350 | 謝謝 :)
351 |
352 | 推 CoNsTaR: Kind 在 type system 裡面也有意思啊 07/26 14:13
353 |
354 | 的確,你說的對。
355 |
356 | 我把原文
357 |
358 | > kind 可以用在「避免與電腦科學的 "type system" 的 "type" 混淆」的情形。
359 |
360 | 改成了
361 |
362 | > kind 可以用在「避免與程式語言中既有的 "type" 混淆」的情形。
363 |
364 | 這樣應該比較不會造成更多誤會?
365 |
366 | 推 mybluesky: 好文推 07/26 16:53
367 |
368 | 謝謝 :)
369 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/26/2020 20:52:28
370 | ```
371 |
--------------------------------------------------------------------------------
/notes/2020-08-07-times.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「次數」變數
5 | 時間 Fri Aug 7 12:30:12 2020
6 | ```
7 |
8 | 之前談過「數量」(參考 https://bit.ly/3elcZGT ),這次我想談談「次數」,
9 | 以及回答幾個讀者問題。
10 |
11 | * 如何命名「次數」變數?
12 | * 「次數」與「數量」有什麼不一樣?
13 | * 可以用 times 嗎?
14 | * 「計算」該用 calculate 還是 compute ?
15 | * 「總和」 sum 與 total 有什麼不一樣?
16 |
17 | ---
18 | * Google 簡報 https://bit.ly/3a1lDcO
19 | * Facebook 相簿 https://bit.ly/2DHjNSx
20 | * GitHub 討論 https://bit.ly/321ResR
21 |
22 | ---
23 | # 先說結論
24 |
25 | * 名詞 + Count
26 | * numberOf + 名詞
27 | * quantity 不適合用在「次數」上
28 | * "times" 可以用,但建議使用更準確的字
29 |
30 | ---
31 | # 「數量」 vs. 「次數」
32 |
33 | 上次談的「數量」聚焦在「實物」上,例如:
34 |
35 | * 不可數名詞 : 水
36 | * 生物 : 貓
37 | * 物品 : 包裹
38 |
39 | 而「次數」是針對「抽象」觀念,例如:
40 |
41 | * 動作 : 分享 (share)
42 | * 事情 : 事故 (incident)
43 | * 狀態 : 成功 (success)
44 |
45 | ---
46 | # 「次數」的語法與「數量」相似
47 |
48 | 就前端來說,有至少兩種常見的格式:
49 |
50 | * 數量 + 名詞
51 | * 1 view 1 次觀看
52 | * 2 shares 2 次分享(複數)
53 |
54 | * 動作(被動) + 數量 + time(s)
55 | * Viewed 1 time 被觀看 1 次
56 | * Shared 2 times 被分享 2 次(複數)
57 |
58 | 就後端來說,與以前談過的「數量」語法很相似:
59 |
60 | * 名詞 + Count
61 | * viewCount 觀看次數
62 | * shareCount 分享次數
63 |
64 | * numberOf + 名詞(複數)
65 | * numberOfViews 觀看次數
66 | * numberOfShares 分享次數
67 |
68 | 「名詞 + quantity」 比較適合用在「數量」上,比較不適合用在「次數」上。
69 |
70 | ---
71 | # 可以用 "times" 嗎?
72 |
73 | 可以。
74 |
75 | 然而,因為 "times" 除了「次數」,還有倍數、時間、時代的意思(倚賴上下文
76 | 脈絡來區分),我建議試著使用更精準的字,例如說:
77 |
78 | * 安裝次數 : installCount
79 | * (遊戲設計)傷害倍數 : damageModifier
80 | * 登入嘗試次數上限 : loginAttemptMaxLimit
81 |
82 | 如果有不知道該怎麼敘述的「次數」,歡迎留言討論,集思廣益。
83 |
84 | ---
85 | # 參考資料:「動作、事情、狀態」等抽象概念的英文字彙
86 |
87 | 用英文命名變數時,常會需要把中文字彙翻譯成英文。
88 |
89 | 而「翻譯實物字彙」相對地簡單,流程大致上是:
90 |
91 | 1. 列出中文字彙C
92 | 2. 利用漢英字典、機器翻譯找到對應的英文字E
93 | 3. 用 Google Image 查英文字E,看看出來的圖片是否與中文字彙C相符
94 |
95 | 然而,「翻譯抽象字彙」時就不太容易用上述第 (3) 步「用 Google Image 輔助
96 | 確認翻譯的精準度」。
97 |
98 | 這裡列出一些「次數」會使用到的字,以供參考。
99 |
100 | ## 動作
101 |
102 | * attempt 嘗試
103 | * click 點擊
104 | * crash 崩潰
105 | * install 安裝
106 | * kill (遊戲中)擊殺
107 | * review 評論
108 | * revision 編修
109 | * share 分享
110 | * view 瀏覽、觀看
111 |
112 | ## 事情、狀態
113 |
114 | * case 案例
115 | * event 事件
116 | * hit 命中
117 | * miss 失誤
118 | * incident 事故
119 | * instance 實例
120 | * occurrence (事情的)發生、存在
121 | * success 成功
122 | * failure 失敗
123 |
124 | 如果遇到不知道怎麼翻譯的字詞,或對某個字的使用情景有疑問,歡迎留言提問 :)
125 |
126 | ---
127 | # 讀者提問:計算該用 calculate 還是 compute ?
128 |
129 | 先說結論:
130 |
131 | * 這是歸納了客觀資訊,再加上主觀見解得到的結論
132 | * 能用「計算機( calculator )」算出來的,用 calculate
133 | * 要用「電腦( computer ) / 圖靈機」來算的,用 compute
134 |
135 | 從字典定義到語源學,我沒有找到決定性的資料可以區分 calculate 、 compute
136 | 在「計算」這個意思上有什麼不同。
137 |
138 | * calculate 的「計算」語意出現在 1560 年代
139 | * 其「算計、策劃」語意出現在 1650 年代
140 | * 例如,會說 "a calculated decision" 「一個算計過的決定」,但不會說
141 | "a computed decision"
142 | * 其「思考、意欲、推測」語意出現在美國 1830 年代
143 |
144 | * compute 的「計算」語意出現在 1630 年代
145 | * 字典: make a calculation, especially using a computer 特指用電腦計算
146 | * 非正式: 認為一件事合邏輯
147 | * 例如,會說 "This does not compute." 「這件事不合邏輯」。
148 |
149 | 但在 calculator 與 computer 的字典定義上,有相當的分別:
150 |
151 | * 計算機 calculator
152 |
153 | > something used for making mathematical calculations, in particular a
154 | > small electronic device with a keyboard and a visual display.
155 |
156 | 描述「小型電子儀器、有鍵盤、有顯示裝置」。
157 |
158 | * 電腦 computer
159 |
160 | > an electronic device for storing and processing data, typically in
161 | > binary form, according to instructions given to it in a variable program.
162 |
163 | 「電腦」的字典定義提到了「計算機」沒有的特點:「能儲存資料、可變動程式指令」
164 |
165 | 是故,我的 *主觀* 解讀是:
166 |
167 | * 能用「計算機( calculator )」算出來的,用 calculate
168 | * 要用「電腦( computer ) / 圖靈機」來算的,用 compute
169 |
170 | ---
171 | # 讀者提問:總和 sum 與 total 有什麼不一樣?
172 |
173 | ## 語意
174 |
175 | * sum 是「以加法算出來的總和」,例如:「 2 + 3 + 5 的總和是 10 」。
176 |
177 | * total 是「由一連串計算得到的總數」,例如「主餐 $60, 飲料 $20, 合計後打
178 | 9 折,總共 $72 」。
179 |
180 | ## 應用
181 |
182 | * sum 常用在數學計算上,例如 Microsoft Excel 的 SUM 函式。
183 | * 可以做為「總和」的變數名稱。
184 |
185 | * total 常見於電商網站結帳時的「小計(subtotal)」或「總金額(total)」。
186 | * 可以做為「總數」的變數名稱。
187 |
188 | * total 也可當作形容詞,例如在遊戲設計、計算傷害值時,從基本攻擊、加乘、
189 | 抗性、命中率、暴擊率最後算出「傷害總數 "totalDamage" 」。
190 |
191 | ---
192 | # 結語
193 |
194 | 一週探索一個觀念,一點一點學會用英文提昇程式的可讀性。
195 |
196 | 每個人都是從零開始學起的;這些題目大多來自讀者提問,我自己也學到了很多。
197 |
198 | 如果你在寫程式時有遇到英文表達上的問題,歡迎留言討論,或到《程式英文》
199 | GitHub 討論區 https://bit.ly/321ResR 提問。
200 |
201 | 這可以幫助我把這個列表整理的更完善,謝謝 :)
202 |
203 | ```
204 | --
205 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
206 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1596774617.A.BA6.html
207 | 推 CaptPlanet: 推 08/07 12:32
208 | 推 jasonwung: 推推 08/07 12:33
209 | 推 kenneth52045: 推 08/07 12:36
210 |
211 | 謝謝 :)
212 |
213 | 推 umum29: 推 命名好的話 程式就好維護 08/07 12:40
214 |
215 | 十分同意
216 |
217 | 有些人是卡在「用英文表達」這一關,希望我整理的這些資料能幫上忙 :)
218 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/07/2020 13:16:48
219 | 推 qq076qq076: 推 08/07 13:23
220 | 推 kasimEnix: 推,學到好多 08/07 13:31
221 | → jobintan: 頂一個先… 08/07 14:45
222 | 推 summerleaves: 有看有推 08/07 14:53
223 | 推 v86861062: 讚 08/07 15:26
224 | 推 mushroom5566: 推推 實用 08/07 15:32
225 |
226 | 謝謝各位 :)
227 |
228 | 推 windmax1: 推 常常有英文命名苦惱 08/07 16:09
229 |
230 | 有沒有興趣聊聊在英文上遇到的困境? :)
231 |
232 | 在這裡推文留言, PTT 站內信,或從以下管道都可以:
233 |
234 | * https://github.com/EngTW/English-for-Programmers/issues
235 | * https://www.facebook.com/twy30
236 | * https://twitter.com/twy30
237 |
238 | 一樣有英文苦惱的版友們,都可以來聊聊 :)
239 |
240 | → tbpfs: 整理好其實可以出書了 08/07 16:18
241 |
242 | 目前還沒想到那麼遠 XD
243 |
244 | 目前的計畫是一週解個 2~3 題,把蒐集到的題目 (*1) 解決掉,看能不能有系統
245 | 地把「程式寫作常見英文問題」解決掉。
246 |
247 | 有任何程式寫作、軟體工程方面的英文題目都可以提出來討論,一起把這個知識庫
248 | 整理的更完善。
249 |
250 | *1: https://github.com/EngTW/English-for-Programmers/issues
251 |
252 | 推 DCTmaybe: 推推 08/07 17:16
253 | 推 ccvs: 推 08/07 18:01
254 | 推 chenshin0719: 推推 08/07 18:47
255 | 推 breccia: 推 很實用!! 08/07 19:02
256 | → mick90207: 推 08/07 19:08
257 | 推 now99: 推 08/07 19:27
258 | 推 kenny0817: 推 08/07 19:27
259 | 推 uopsdod: 推 08/07 19:34
260 | 推 y956403: 推 感謝分享 08/07 19:42
261 | 推 x246libra: 推 08/07 21:34
262 | 推 smily134: 推 08/07 22:07
263 | 推 automaton: 必須推 08/07 23:32
264 | 推 tz5514: 推 08/07 23:47
265 | 推 ekin1983: 謝謝分享 08/07 23:51
266 | 推 ihavenosense: 學習了! 08/08 00:23
267 |
268 | 感謝各位的欣賞與鼓勵 orz
269 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/08/2020 03:21:02
270 | 推 olycats: 謝謝分享 很用心很有幫助 08/08 06:45
271 | 推 lmr3796: 推推推 08/08 08:02
272 | 推 onegoman: 推 08/08 09:45
273 | 推 evilplayer: 推~~ 08/08 09:48
274 | 推 Talinwu: 推 08/08 09:51
275 | 推 westercc: 大推! 08/08 10:43
276 | 推 ttjerry0204: 推 08/08 10:48
277 | 推 sharku: 推 08/08 11:32
278 | 推 fanatics5566: 推個 覺得有趣 08/08 12:32
279 |
280 | 謝謝 :)
281 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/08/2020 15:03:28
282 | 推 EntHeEnd: 推 08/08 16:01
283 | 推 ray13242000: 推 常遇到 08/08 20:45
284 | 推 a9261020: 實用推 08/08 21:34
285 | 推 nba887215: 感謝用心整理 08/08 21:34
286 | 推 mirror0227: 三大難題之一XD 08/09 00:39
287 |
288 | 命名真的不容易 XD
289 |
290 | 推 FY4: 推 08/09 00:50
291 | 推 Nancy010006: 推 08/09 10:51
292 |
293 | 謝謝各位的鼓勵 :)
294 |
295 | 推 woopoo: I,J,K 08/09 18:57
296 |
297 | 變數三天王 XD
298 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/10/2020 08:16:22
299 | 推 elliotpvt: 感謝分享 08/10 08:40
300 | 推 slowwalker: 推 08/10 10:05
301 | 推 lestibournes: 推好文 08/11 09:54
302 | 推 molopo: 推 08/11 10:10
303 | 推 jerboaa: 棒 08/11 13:06
304 | 推 thumbe31949: 推 08/11 15:59
305 | 推 zxc6414189: 推 08/11 23:51
306 |
307 | 謝謝 :)
308 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/12/2020 07:05:15
309 | 推 zxd546123: 中推 08/12 20:25
310 | 推 bmpss92196: 推 08/13 14:16
311 | 推 ArJiE: 推 08/14 00:33
312 |
313 | 謝謝 :)
314 |
315 | → marc47: 其實就後面Cnt即可,例如getCnt, releaseCnt, delCnt越簡 08/15 22:29
316 | → marc47: 單越好,而且func裏面處理完就釋放, 不要跳到別的func裏, 08/15 22:29
317 | → marc47: 變數越簡單扼要越容易讓人想看code 08/15 22:29
318 | 推 marc47: https://github.com/kubernetes/kubernetes/search?q=cnt& 08/15 22:31
319 | → marc47: type= 08/15 22:31
320 |
321 | > 變數越簡單扼要越容易讓人想看code
322 |
323 | 十分同意。
324 |
325 | 推 xiao2chen: cnt num size 有夠煩XD 08/16 09:18
326 |
327 | 「縮寫與否」的確是論戰的熱門題目 XD
328 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/17/2020 05:57:37
329 | 推 mickey94378: 推推 可以在每個介紹下面寫點範例 像是 google Airb 08/18 06:36
330 | → mickey94378: nb style guild 會有 good bad 的舉例 08/18 06:36
331 |
332 | 同意,適當的好、壞例子能幫助讀者掌握觀念。
333 |
334 | 我會試著注意這方面,謝謝你的建議。 :)
335 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/21/2020 12:27:15
336 | 推 BlazarArc: 推 08/21 14:01
337 |
338 | 謝謝 :)
339 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/29/2020 07:43:21
340 | ```
341 |
--------------------------------------------------------------------------------
/notes/2020-09-04-state-status.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「狀態」變數
5 | 時間 Fri Sep 4 11:55:29 2020
6 | ```
7 |
8 | 本週主週:
9 |
10 | * 如何命名「狀態」變數?
11 | * State, Status 有什麼不一樣?
12 | * 「第N個」要怎麼說?
13 |
14 | * Google 簡報 https://bit.ly/2GtLobb
15 | * GitHub 討論 https://bit.ly/321ResR
16 |
17 | ---
18 | # State
19 |
20 | ## 語源、語意
21 |
22 | * 1200 年代
23 | * 人 / 物的暫時屬性、狀態
24 | * 狀況、情況
25 | * 社會地位
26 | * 13 世紀後期:形、結構的物理形態
27 | * 1530 年代:情緒、心理狀態
28 | * 今日:人 / 物在特定時間點的狀態
29 |
30 | ## 案例
31 |
32 | * finite-state machine 有限狀態機
33 | * state of matter 物質狀態(固態、液態、氣態)
34 | * 電腦科學:資訊系統、程式的狀態;記憶事件歷程的功能
35 | * stateful 有狀態的
36 | * stateless 無狀態的
37 | * .NET Threading `ThreadState`
38 | * Running, Stopped, Suspended
39 | * .NET Data `ConnectionState`
40 | * Closed, Open, Connecting, Executing
41 |
42 | ## 參考資料
43 |
44 | * https://www.etymonline.com/word/state
45 | * https://www.lexico.com/definition/state
46 | * https://www.merriam-webster.com/dictionary/state
47 | * https://en.wikipedia.org/wiki/State_(computer_science)
48 | * https://en.wikipedia.org/wiki/Finite-state_machine
49 | * https://en.wikipedia.org/wiki/State_of_matter
50 | * https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadstate?view=netcore-3.1
51 | * https://docs.microsoft.com/en-us/dotnet/api/system.data.connectionstate?view=netcore-3.1
52 |
53 | ---
54 | # Status
55 |
56 | ## 語源、語意
57 |
58 | * 1670 年代:情況、狀況的高峰
59 | * 1791 :人的法律地位
60 | * 1920 :人的職業、社會地位
61 | * 今日:情景、整體脈絡的狀態
62 |
63 | ## 案例
64 |
65 | * exit status 退出狀態
66 | * status bar 狀態列
67 | * .NET Net `HttpStatusCode`
68 | * OK, NotFound, InternalServerError
69 | * .NET Threading `TaskStatus`
70 | * Created, Running, Canceled
71 |
72 | ## 參考資料
73 |
74 | * https://www.etymonline.com/word/status
75 | * https://www.lexico.com/definition/status
76 | * https://www.merriam-webster.com/dictionary/status
77 | * https://en.wikipedia.org/wiki/Exit_status
78 | * https://en.wikipedia.org/wiki/Status_bar
79 | * https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=netcore-3.1
80 | * https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskstatus?view=netcore-3.1
81 |
82 | ---
83 | # State, Status 有什麼不一樣?
84 |
85 | state, status 都能讓讀者聯想到「狀態」這個觀念,就看你想強調哪一個面向。
86 |
87 | * 語源都可追溯至拉丁文的 status :「狀態、形態、樣子、位置」
88 |
89 | * state 傾向「個體『狀態』屬性」
90 | * finite-state machine 有限狀態機
91 | * state of matter 物質形態(固態、液態、氣態)
92 | * .NET ConnectionState, WebSocketState, ThreadState
93 |
94 | * status 傾向「就整體脈絡的綜合判斷;事態、情況的『狀態』」
95 | * exit status 退出狀態
96 | * status bar 狀態列
97 | * .NET FtpStatusCode, HttpStatusCode, TaskStatus
98 |
99 | 例如說,在某個邏輯模型裡,可能是這樣子界定 state, status :
100 |
101 | * 某個運算單元
102 | * state: { 讀資料, 寫資料, 解碼, 執行指令, 閒置 } ← 此個體當前的狀態
103 | * status: { 忙碌, 閒置 } ← 就整體脈絡的綜合判斷
104 |
105 | 也就是看寫程式的人想要如何定義「個體狀態 vs. 整體脈絡」。
106 |
107 | ## 參考資料
108 |
109 | * https://docs.microsoft.com/en-us/dotnet/api/system.data.connectionstate?view=netcore-3.1
110 | * https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.websocketstate?view=netcore-3.1
111 | * https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadstate?view=netcore-3.1
112 |
113 | * https://docs.microsoft.com/en-us/dotnet/api/system.net.ftpstatuscode?view=netcore-3.1
114 | * https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=netcore-3.1
115 | * https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskstatus?view=netcore-3.1
116 |
117 | ---
118 | # 「第N個」 / 序數 / 個體在群體中的位置、索引
119 |
120 | 題目出處: https://github.com/EngTW/English-for-Programmers/issues/53
121 |
122 | > 你好,我最近在處理股票資料的api,
123 | > 有一個內容是我想要將資料整理成K線的形式,
124 | > 我的Kbar calss中想要存「屬於今天中的第N根Kbar」,這種狀況要怎麼命名呢。
125 | > 像是以一根10:00~ 10:15的15分鐘k線,8:45開盤,這個變數會存5,代表是今天
126 | > 的第六根K線
127 |
128 | 要表示個體在群體中的「第N個」,可以用 "ordinal" 這個字,它是
129 | 「序數 (ordinal number)」的縮寫。
130 |
131 | 例如 .NET DataColumn 的 `Ordinal` 屬性,代表一 DataColumn 物件在其所屬的
132 | DataColumnCollection 中的位置(第N個)。
133 |
134 | 要表示「個體在群體中的位置、索引」,也可以參考以下這些字,選擇最符合你想
135 | 表達的語意:
136 |
137 | * index 索引
138 | * id
139 | * key
140 | * name 名字
141 | * title 標題
142 |
143 | ## 參考資料
144 |
145 | * https://docs.microsoft.com/en-us/dotnet/api/system.data.datacolumn.ordinal?view=netcore-3.1
146 |
147 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/53 討論
148 | 的網友。
149 |
150 | ---
151 | # 結語
152 |
153 | 適當的命名可以幫助你的讀者了解你的程式碼的意圖,降低溝通成本,減少誤會的
154 | 機率。
155 |
156 | 這系列文章將繼續從語源資料、實用性的角度,探討《程式英文》字彙的語意、使
157 | 用情景,幫助大家提昇程式碼的可讀性。
158 |
159 | 歡迎推文留言討論、提問 :)
160 |
161 | ```
162 | --
163 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
164 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1599191750.A.773.html
165 | 推 jasonwung: 推 09/04 12:18
166 | 推 sniper2824: 推個 09/04 12:21
167 | 推 ihave3cm: 推起來 09/04 12:47
168 | 推 deathlightx: 此系列,必推 09/04 13:14
169 | 推 summerleaves: 有看有推 09/04 13:25
170 | 推 newhandfun: 推 09/04 13:25
171 | 推 qaz0101: 受益良多,必推 09/04 14:42
172 | 推 ian90911: 推 09/04 15:19
173 | 推 BlazarArc: 推 09/04 16:28
174 |
175 | 謝謝 :)
176 |
177 | 推 unmolk: 推!想看property attribution之類的要怎麼用 09/04 17:12
178 |
179 | 目前有一個題目是關於「屬性: attribute vs. property 」,我想知道這與你想
180 | 知道的 property, attribution 是同個方向嗎?如果不是,能否描述一下你的疑
181 | 問? :)
182 |
183 | https://github.com/EngTW/English-for-Programmers/issues/25
184 |
185 | 噓 B0988698088: 小建議:結論可以放前面嗎?上面那些單字個別解說放 09/04 17:41
186 | → B0988698088: 後面有興趣的自己會去延伸閱讀 09/04 17:41
187 |
188 | 了解,結論放前面對讀者來說比較省時省力。
189 |
190 | 推 uopsdod: 推 09/04 18:24
191 | 推 lairx: 推 09/04 18:47
192 | 推 CaptPlanet: 不錯勃 有點東西 09/04 19:33
193 | 推 jack42107: 推這系列 感謝用心 09/04 20:23
194 | 推 Ouranos: 推推! 謝謝分享 :) 09/04 21:11
195 | 推 ddoy7: 推 09/04 21:19
196 |
197 | 謝謝各位的欣賞 :)
198 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/04/2020 23:34:14
199 | 推 obamina48: 推!受益良多! 09/04 23:39
200 | 推 l823qqqqqqqq: 感謝分享,有獲得啟發 09/04 23:47
201 |
202 | 謝謝 :)
203 |
204 | 推 unmolk: 喔對我打錯了 是attribute XD 感謝分享! 09/05 00:09
205 |
206 | 了解 :)
207 |
208 | 推 CoNsTaR: context, env: 環境狀態 09/05 04:46
209 | → CoNsTaR: 也可以講一下 has, with, is, at... 也可以命名狀態變數 09/05 04:46
210 |
211 | 謝謝你提供題目 :) 我把它整理成以下項目,能否請你看看與你想的方向是否一致
212 | ?謝謝 :)
213 |
214 |
215 | * 環境狀態: context, environment 有什麼不一樣?
216 | * https://github.com/EngTW/English-for-Programmers/issues/56
217 |
218 | * 介詞: with, at, from, to, in, than, ... 使用情景
219 | * https://github.com/EngTW/English-for-Programmers/issues/57
220 |
221 | * 現在簡單式(simple present)的使用情景
222 | * https://github.com/EngTW/English-for-Programmers/issues/58
223 |
224 | * 更多「狀態」變數的實例
225 | * https://github.com/EngTW/English-for-Programmers/issues/59
226 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/05/2020 08:53:36
227 | 推 ingramchen: 通通用status,state 留給 framework 用 09/05 11:48
228 |
229 | 很有趣的想法,折衷/經驗法則。
230 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/06/2020 01:53:41
231 | 推 changyuheng: 推 09/06 02:50
232 |
233 | 謝謝 :)
234 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/06/2020 08:00:30
235 | 推 alihue: 推 09/06 12:46
236 |
237 | 謝謝 :)
238 |
239 | → geminitw: 程設英文 09/06 23:27
240 |
241 | 謝謝你的建議 :)
242 |
243 | 我對這個也很好奇,就台灣的語文習慣而言,《English for Programmers》怎麼
244 | 翻會比較好?
245 |
246 | * 直譯「程式設計師英文」
247 | * 目前稱作「程式英文」
248 | * 鄉民 geminitw 推文提案「程設英文」
249 | * 縮寫提案「程英」 XD
250 |
251 | 我當初是以 Google, books.com.tw 的搜尋結果為基準,「程式」似乎是最常用的
252 | 詞,就先用《程式英文》這個名字;我想知道就鄉民的中文語感來說,覺得如何。 :)
253 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/07/2020 01:37:07
254 | 推 geminitw: Ex:商用英文 程設英文除了變數及函數命名 註解及技術文 09/07 20:10
255 | → geminitw: 件才是重點 09/07 20:10
256 |
257 | 我再查了一下,從 Google 得到的數據是
258 |
259 | * "程式書": 10900
260 | * "程設書": 64
261 |
262 | * "程式課": 33400
263 | * "程設課": 5700
264 |
265 | * "程式課程": 107000
266 | * "程設課程": 1400
267 |
268 | * "程式訓練": 15000
269 | * "程設訓練": 284
270 |
271 | 似乎在「描述 "programming" 這個概念上」,「程式」比「程設」更為通用?
272 |
273 | ---
274 | > 除了變數及函數命名 註解及技術文件才是重點
275 |
276 | 十分同意;我還沒機會去研究這個,但有個東西叫 "controlled natural language",
277 | 可說是「簡化了的自然語言」 (*1) ;可用在「針對特定技術領域,方便母語非英
278 | 文者溝通」上。
279 |
280 | 或許適合用來寫註解、技術文件。
281 |
282 | ---
283 | *1: 限定使用相對簡單的文法與字彙,例如:
284 |
285 | * 把句子寫短
286 | * 避免使用代名詞
287 | * 使用主動語氣
288 |
289 | ## 參考資料
290 |
291 | * https://en.wikipedia.org/wiki/Controlled_natural_language
292 | * https://en.wikipedia.org/wiki/Attempto_Controlled_English
293 |
294 | 推 Tatum0119: 很棒 推 09/07 22:57
295 | 推 iwillbehere: 推 09/08 13:57
296 |
297 | 謝謝 :)
298 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/09/2020 20:48:53
299 | 推 ygl01181: 推 09/14 07:32
300 | 推 NCUcsie105: 推 09/15 08:29
301 |
302 | 謝謝 :)
303 | ※ 編輯: AmosYang (136.56.13.184 美國), 09/18/2020 12:17:29
304 | ```
305 |
--------------------------------------------------------------------------------
/notes/2020-07-10-count-number-quantity.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「數量變數」
5 | 時間 Fri Jul 10 14:47:45 2020
6 | ```
7 |
8 | 「英文」是不少人學寫程式的一個關卡,而「命名」又是電腦科學最難的問題之一
9 | 。我正在整理幾個最常見的「如何用英文命名程式裡的某個東西?」的問題與答案
10 | ,在此與各位分享目前整理好的第一個題目:
11 |
12 | * 如何命名「數量變數」?
13 | * Count / Number / Quantity
14 | * 什麼時候該用哪個字?該怎麼用?
15 |
16 | ---
17 | * Google 簡報版: https://bit.ly/38OWoKf
18 | * Google 簡報原始檔: https://bit.ly/3elcZGT
19 | * Facebook 相簿版: https://bit.ly/3iNsgDO
20 | * GitHub 討論區: https://bit.ly/321ResR
21 |
22 | ---
23 | 首先,可以試試看命名以下變數(文末有參考答案):
24 |
25 | 1. 玩家(player)數量
26 | 2. 彈藥(ammo)數量
27 | 3. 子彈(bullet)質量(mass) (以克(gram)計)
28 | 4. 生命值(hit points)
29 |
30 | 如果這對你來說沒有難度,或許你會有興趣到 GitHub 討論區看看其它我正在整理
31 | 的題目: https://bit.ly/321ResR
32 |
33 | ---
34 | # 命名「數量變數」的方法
35 |
36 | 1. 辨認變數名詞詞性
37 | * 不可數名詞
38 | * 可數生物
39 | * 可數非生物
40 | 2. 對應單字及格式(見後文)
41 | * 可數生物、可數非生物: Count / Number
42 | * 不可數名詞、可數非生物: Quantity
43 |
44 | ---
45 | # 不可數名詞
46 |
47 | ## 推薦格式
48 |
49 | * 不可數名詞 + In + 單位(複數)
50 |
51 | goldInKilograms 黃金(以公斤計)
52 |
53 | * 單位(複數) + Of + 不可數名詞
54 |
55 | kilogramsOfGold 黃金(以公斤計)
56 |
57 | ## 其它格式
58 |
59 | * 不可數名詞 + Amount : goldAmount 黃金數量
60 |
61 | * 不可數名詞 + Quantity : goldQuantity 黃金數量
62 |
63 | * amountOf + 不可數名詞 : amountOfGold 黃金數量
64 |
65 | * quantityOf + 不可數名詞 : quantityOfGold 黃金數量
66 |
67 | 這些格式無法清楚表達數量單位,其可讀性在科學或金融計算上並不理想,但在其
68 | 它情景或許不是問題(例如,遊戲設計)。
69 |
70 | ---
71 | # 可數生物
72 |
73 | ## 推薦格式
74 |
75 | * 生物(單數) + Count
76 |
77 | studentCount 學生人數
78 |
79 | 尤其適合為「用來計數的變數」命名
80 |
81 | * numberOf + 生物(複數)
82 |
83 | numberOfEmployees 員工人數
84 |
85 | ## 常見問題
86 |
87 | * 生物(單數) + Number
88 |
89 | 在語意上是「號碼」的意思
90 |
91 | studentNumber 學生號碼
92 |
93 | * countOf + 生物(複數)
94 |
95 | 在語法上通常不會這樣寫
96 |
97 | ---
98 | # 可數非生物
99 |
100 | ## 推薦格式
101 |
102 | * 非生物(單數) + Count
103 |
104 | bookCount 書本數量
105 |
106 | 尤其適合為「用來計數的變數」命名
107 |
108 | * 非生物(單數) + Quantity
109 |
110 | bookQuantity 書本數量
111 |
112 | 尤其適合用在「貨物」上
113 |
114 | * numberOf + 非生物(複數)
115 |
116 | numberOfBooks 書本數量
117 |
118 | * quantityOf + 非生物(複數)
119 |
120 | quantityOfBooks 書本數量
121 |
122 | 尤其適合用在「貨物」上
123 |
124 | ## 常見問題
125 |
126 | * 非生物(單數) + Number
127 |
128 | 在語意上是「號碼」的意思
129 |
130 | accountNumber 帳戶號碼
131 |
132 | * countOf + 非生物(複數)
133 |
134 | 在語法上通常不會這樣寫
135 |
136 | ---
137 | # 其它討論
138 |
139 | * 有的時候,程式可讀性的確是 *相對地* 沒那麼重要。
140 |
141 | * 滿足需求、解決問題、創造價值最重要。
142 |
143 | * 提昇程式可讀性的方法不止一種
144 |
145 | * 要把程式碼上下文脈絡、使用情景、團隊文化、產業領域也納入考量。
146 |
147 | ---
148 | 相對於「寫作風格」(駝峰式大小寫、蛇式/烤肉串式、等等),我想從另一個角
149 | 度,聚焦於「學會用英文表達想法」,
150 |
151 | 學會用英文提昇程式可讀性。
152 |
153 | 我很想知道讀者在寫程式時,遇到了怎麼樣的英文表達問題。
154 |
155 | 我目前有蒐集到一些題目,例如:
156 |
157 | * Count / Length / Size, 什麼時候該用哪個字?該怎麼用?
158 | * Copy / Clone / Duplicate
159 | * Sum 與 Total 的差別
160 | * Validate vs. Verify
161 |
162 | 很歡迎讀者推文(或到 GitHub 討論區 https://bit.ly/321ResR )提出
163 |
164 | * 問題
165 | * 建議
166 | * 感想
167 |
168 | 謝謝。
169 |
170 | ---
171 | # 練習題 *參考* 答案
172 |
173 | 1. numberOfPlayers, playerCount
174 | 2. quantityOfAmmo, ammoQuantity
175 | 3. bulletMassInGrams
176 | 4. hitPoints
177 |
178 | ```
179 | --
180 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
181 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1594363672.A.7D0.html
182 | 推 chuegou: 這個有趣 07/10 14:56
183 | 推 goodseeyou: 推 07/10 14:57
184 | 推 sk6852: 實用 07/10 15:10
185 | 推 devilkool: 實用推 07/10 15:14
186 | 推 y2468101216: 推 07/10 15:21
187 |
188 | 謝謝各位的欣賞 :) 如果在程式寫作上有任何與英文表達有關的問題,請讓我知道
189 | ,這會是「用英文提昇程式可讀性」很棒的研究題材。
190 |
191 | 推 vi000246: 我喜歡台式英文 bulletWeight remainLife 07/10 15:31
192 |
193 | 完全能理解,解決問題優先。
194 |
195 | 語言能做到優雅當然是好,但最重要的功能還是溝通(人與人的溝通、人與機器的
196 | 溝通)。
197 |
198 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/8 來追蹤
199 | 這個題目,謝謝 :)
200 |
201 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/10/2020 15:56:07
202 | 推 jobintan: niceTutorial, it_is_very_useful. 07/10 15:52
203 |
204 | XD
205 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/10/2020 15:57:50
206 | → askaleroux: magicNumber // do not erase this 07/10 15:58
207 | → testPtt: 基本上不用Quantity 太長 07/10 16:06
208 |
209 | 完全能理解,縮寫、簡寫、更短的字、更簡潔的寫法,只要能解決問題,都是好的
210 | 。
211 |
212 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/7 來追蹤
213 | 這個題目,謝謝 :)
214 |
215 | 推 RedArmy95: 推 07/10 16:15
216 | 推 chuegou: #define ZERO 0 07/10 16:31
217 | 推 unmolk: 樓上是殺小xddd 07/10 16:52
218 | 推 bowin: 推 AmosYang 好文! 07/10 16:59
219 | 推 accessdenied: zero = 0 這個我真的看到! 還有 True = 1, False = 07/10 17:09
220 | → accessdenied: 0 07/10 17:09
221 | 推 alihue: 推 07/10 17:12
222 | 推 sniper2824: 好文 07/10 17:12
223 | 推 ben810514: bulletCount 07/10 17:27
224 | → ben810514: 沒事 是重量以為是數量 07/10 17:28
225 | → sirius65482: 不管啦 通通用xxxNum 07/10 17:40
226 | → bheegrl: ammoQty 07/10 17:40
227 |
228 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/7 來追蹤
229 | 「縮寫、簡寫」這個題目;謝謝提供這個題目 :)
230 |
231 | 推 paulshain04: 很讚欸 推一個 07/10 18:07
232 | 推 Rm: amount跑去哪了 07/10 18:09
233 |
234 | amount 整理在「不可數名詞」的「其它格式」那段。 :)
235 |
236 | amount 本身當主詞時,常用來描述金錢上的「總金額(total amount)」,我開了
237 | https://github.com/EngTW/English-for-Programmers/issues/9 來追蹤這個題目
238 | ,謝謝 :)
239 |
240 | 推 atpx: 好文, 不得不推 07/10 19:02
241 | → pttano: 我都定arg1,arg2,var1,var2 07/10 19:10
242 | → pttano: 我都定arg1,arg2,var1,var2 07/10 19:10
243 | 推 kokolotl: a1, b1啊~~ 07/10 19:11
244 | → pttano: 我都定arg1,arg2,var1,var2 07/10 19:12
245 | → pttano: 我都定arg1,arg2,var1,var2 07/10 19:13
246 | → pttano: 我都定arg1,arg2,var1,var2 07/10 19:14
247 | 推 infixman: 推推 07/10 19:19
248 | 推 chuegou: 樓上重複定義編譯器不給過 07/10 19:21
249 | 推 dks50217: Cnt 07/10 19:21
250 |
251 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/7 來追蹤
252 | 「縮寫、簡寫」這個題目;謝謝提供這個題目 :)
253 |
254 | → yyc1217: remove delete erase cancel dismiss 07/10 19:24
255 |
256 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/10 來追蹤
257 | 這個題目,謝謝 :)
258 |
259 | 推 enthos: pn, an, bg, hp \ Forth(Write-only lang.) style. 07/10 19:35
260 |
261 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/7 來追蹤
262 | 「縮寫、簡寫」這個題目;謝謝 :)
263 |
264 | 推 goldflower: 看過中國人用拼音寫扣 jin_jia_ki_si 07/10 19:46
265 |
266 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/8 來追蹤
267 | 這個題目,謝謝 :)
268 |
269 | → leo5916267: 多查英文字典吧?有時候直接問英文好的人資XD超好笑 07/10 19:57
270 | → leo5916267: ,寫程式還會問到人資那邊 07/10 19:57
271 | 推 gasbomb: 上一份工作看到的 氣死https://i.imgur.com/x9GmljV.jpg 07/10 19:59
272 |
273 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/8 來追蹤
274 | 這個題目,謝謝 :)
275 |
276 | 推 jason90929: 讚 07/10 20:09
277 | 推 Lhmstu: 推推 07/10 21:00
278 | 推 negligence: 推 07/10 21:39
279 | 推 invidia: 感謝分享 07/10 22:13
280 | → abc0922001: 感謝分享,命名真的是難題 07/10 22:26
281 | 推 jasonwung: 實用推 07/10 22:59
282 | → labbat: qwertyyuiop 07/10 23:10
283 | 推 CaptPlanet: 推 07/10 23:21
284 | 推 dces4212: nr_student 07/10 23:28
285 |
286 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/7 來追蹤
287 | 「縮寫、簡寫」這個題目;謝謝 :)
288 |
289 | → OrzOGC: 用拼音真的...還有日文拼音的...冏... 07/10 23:46
290 |
291 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/8 來追蹤
292 | 這個題目,謝謝 :)
293 |
294 | 推 Dracarys: foo bar baz 07/11 00:10
295 |
296 | 我開了 https://github.com/EngTW/English-for-Programmers/issues/11 來追蹤
297 | "metasyntactic variable" 這個題目,謝謝 :)
298 |
299 | 推 Luke3723: 推 07/11 00:21
300 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/11/2020 02:40:00
301 |
302 | 感謝各位的欣賞與提供題目 orz
303 |
304 | 如果我漏看了題目,請告訴我,謝謝 :)
305 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/11/2020 02:44:32
306 | 推 Bencrie: nr_ 這個是 Linux kernel 的命名 07/11 02:46
307 |
308 | 感謝指點 orz
309 |
310 | 推 richard07250: 先推在看 07/11 03:39
311 | 推 Ouranos: Amos 必推!!! 07/11 04:02
312 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/11/2020 05:36:24
313 | 推 ben4562002: 推 獲益良多 07/11 08:32
314 | 推 joy7658x348: 推!命名對新人工程師更是一個問題XD常常會看不懂那 07/11 09:45
315 | → joy7658x348: 是啥 07/11 09:45
316 | 推 NeCool: 推 07/11 09:57
317 | 推 coder5566: 推 07/11 11:34
318 | 推 believe91326: 實用推 07/11 15:08
319 | 推 zxcv860513: 推,很怕看到需要通靈的命名 07/11 16:12
320 |
321 | 感謝各位的欣賞 :)
322 |
323 | 如果能想到「很難看懂、需要通靈」的命名案例,請讓我知道;這可以幫助我把這
324 | 些資料整理得更完善,謝謝。
325 |
326 | 在這篇底下推文,或在 GitHub 或 Facebook 留言都可以 :)
327 |
328 | * GitHub: https://github.com/EngTW/English-for-Programmers/issues
329 | * Facebook: https://bit.ly/3iNsgDO
330 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/12/2020 04:07:11
331 |
332 | 補上 Google 簡報原始檔: https://bit.ly/3elcZGT
333 | ※ 編輯: AmosYang (136.56.13.184 美國), 07/12/2020 12:44:21
334 | 推 klandakuei: 推 07/12 22:15
335 | 推 visual: 推 07/14 18:55
336 | 推 zelt: 推 07/17 10:20
337 | 推 a8319: 有趣又實用 07/20 14:00
338 | 推 beryah: 推 07/26 00:57
339 |
340 | 謝謝 :)
341 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/08/2020 03:09:46
342 | ```
343 |
--------------------------------------------------------------------------------
/notes/2020-07-31-clear-empty-delete-remove.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「刪除」功能
5 | 時間 Fri Jul 31 18:08:38 2020
6 | ```
7 |
8 | 「刪除(delete)」是資料處理 CRUD 四大基本項目之一。
9 |
10 | 這篇文章收錄了幾個與「刪除」有關的程式設計常用字,以及回答讀者相關問題。
11 |
12 | * 如何命名「刪除」功能?
13 | * Clear / Empty / Delete / Remove
14 | * 有什麼不一樣?
15 |
16 | * Google 簡報 https://bit.ly/2XazA2P
17 | * Facebook 相簿 https://bit.ly/2EsPmj9
18 | * GitHub 討論 https://bit.ly/321ResR
19 |
20 | # 先說結論
21 |
22 | * 在實作後端時,「清除資料容器所有內容物」,使用 clear 。
23 | * 在設計前端時,「清除容器內容物」,使用 clear 、 empty 都可以。
24 |
25 | * 在實作後端時,「(從容器)移除物件」,使用 remove 。
26 | * 「刪除物件」,使用 delete 、 remove 都可以。
27 |
28 | ---
29 | 請試試看將以下「刪除、清除」等詞對應到英文。(本文末有參考答案)
30 |
31 | 1. 清除文字欄
32 | 2. 清空購物車
33 | 3. 刪除文字欄中第三行字
34 | 4. 移除購物車中第三項貨品
35 |
36 | 如果這對你來說很容易,可以到《程式英文》 GitHub 討論區 https://bit.ly/321ResR
37 | 看看有沒有更有趣的題目,或提出你在寫程式時遇到的英文問題;這能幫助我把這
38 | 個知識庫整理得更完善。謝謝 :)
39 |
40 | ---
41 | # 從有到無
42 |
43 | 用來表達「刪除」動作的字可略分為兩大類:
44 |
45 | * 清除「容器、區域、空間」的內容物
46 | * clear, empty
47 | * 消滅或移除物件
48 | * delete, remove
49 |
50 | 這篇文章將會探討以上兩組動詞,以及回答讀者提問:
51 |
52 | * clear vs. clean
53 | * delete vs. erase
54 | * cancel vs. dismiss
55 |
56 | ---
57 | # 清除容器內容物: Clear vs. Empty
58 |
59 | * clear 意指「清除某區域中的(障礙)物件」。
60 |
61 | 例如,影劇中醫生電擊急救病人時會大喊 "Clear!" 來要求其它人「清場、讓開
62 | 、離遠一點」。
63 |
64 | * empty 意指「清空某容器的內容物」。
65 |
66 | 例如,電影《瞞天過海:13王牌》中 Al Pacino 演的角色大吼
67 | "Everyone in this room! Empty your pockets! Now!"
68 | 「房間裡的每個人!掏空清出你口袋裡的東西來!現在馬上!」
69 |
70 | 易言之,作為動詞,
71 |
72 | * clear 偏向於「清場」;「場」可以是實體區域,或著是資料容器。
73 |
74 | * empty 強調「清空(實體)容器的內容物」
75 | * 例如「口袋」、電商網站的「購物車」
76 |
77 | ## clear 的應用實例
78 |
79 | * .NET 與 Java 採用 clear 作為「清空容器」 [1] 的方法動詞。
80 | * C++ Standard Library 採用 clear 作為「清空容器」 [7] 的方法動詞。
81 | * 《微軟 PowerShell 動詞表》 [2] 推薦使用 clear 作為「清空容器」的動詞。
82 |
83 | ## empty 的應用實例
84 |
85 | * .NET 採用 empty 作為「取得空的容器、字串、 Guid 、等等」 [3][9][10]
86 | 的方法動詞、成員名字。
87 | * C++ Standard Library 採用 empty 作為「測試此容器是否為空的」 [6] 函式名字。
88 |
89 | ---
90 | 在實作後端時,我推薦使用 clear 來表達「清空資料容器」的動作。
91 |
92 | 在設計前端時,例如,電商網站、 webmail 介面, clear 與 empty 都可以用來
93 | 表達「清空購物車」、「清空垃圾筒」的動作,而 empty 會比 clear 更能強調「
94 | 清空」這個動作。
95 |
96 | ---
97 | # 消滅或移除物件: Delete vs. Remove
98 |
99 | * delete 意指「刪除」,把東西從存在變成消滅。
100 |
101 | * remove 意指「移除」,也可以表達「刪除」。
102 |
103 | ## delete 的應用實例
104 |
105 | * Facebook 刪除文章
106 | * Twitter 刪除文章
107 | * HTTP 動詞之一
108 | * C++ 銷毀物件(釋放記憶體)
109 | * Windows 刪除檔案
110 | * SQL 刪除資料
111 | * .NET 與 Java 用 delete 作為「刪除檔案」 [4] 的方法動詞
112 |
113 | ## remove 的應用實例
114 |
115 | * 《微軟 PowerShell 動詞表》 [2] 推薦使用 remove 表達「從容器移除物件」
116 | 的動作
117 | * .NET 與 Java 採用 remove 作為「從容器移除物件」 [5] 的方法動詞
118 | * Facebook 「從好友建議名單移除某帳號」
119 | * Linux 刪除檔案
120 |
121 | ## 互相替代性
122 |
123 | * remove 多半可以用來取代 delete 表達「刪除」的意思
124 | * 例如在 Linux 上刪除檔案的 `rm` 指令
125 |
126 | * 但 delete 多半無法取代 remove 表達「(從容器)移除物件」的意思
127 |
128 | ---
129 | # 讀者問題: Clear vs. Clean
130 |
131 | * clear 偏向「清場」的意思。
132 |
133 | * clean 意指「清潔、去除污垢」的意思。
134 |
135 | 假設這樣的情景:「桌上散著書本紙張」,而我們會用「雜亂」來形容這桌子。
136 |
137 | 這時候, clear 與 clean 都可以表達「清掃整理」的意思。
138 |
139 | 再假設另一個情景:「桌上滿是湯水油污」,而我們會用「骯髒」來形容這桌子。
140 |
141 | 這時候,就適合用 clean ,而不適合用 clear 。
142 |
143 | 寫作程式時,就「清空容器」來說,例如「清空房間裡的怪物」, clear 會比
144 | clean 更適合。
145 |
146 | 另外,有時候會用 clear 或 clean 這個字來表達「初始化記憶體區塊」這個動作
147 | ,然而,「初始化」用 initialize 表達會更適合。
148 |
149 | ---
150 | # 讀者問題: Delete vs. Erase
151 |
152 | * delete 的原意是「畫記、畫線槓掉想消除的文字」
153 | * 例如, HTML 的 `` 標籤
154 |
155 | * erase 的原意是「以擦、抹消除文字」。
156 |
157 | 在現代數位世界裡,
158 |
159 | * 在與人溝通時, delete 與 erase 都可以表達「刪除資料、檔案」。
160 | * 在寫程式時,多半用 delete 表達「刪除資料、物件、檔案」。
161 | * C++ Standard Library Vector 採用 erase 來表達「刪除容器中的物件」 [8]
162 | 的函式動詞。
163 | * 可能是為了避免與 C++ 關鍵字 delete 衝突。
164 | * 在「抹除儲存媒體資料」時(例如:磁帶),用 erase 。
165 |
166 | ---
167 | # 讀者問題: Cancel vs. Dismiss (前端設計)
168 |
169 | 在前端設計的情景下,
170 |
171 | ## Cancel 「取消」
172 |
173 | * 適用於「讓使用者選擇停止、放棄正要進行的動作」
174 | * 例如:「是否要將此文章發佈出去?」
175 | * Cancel (取消)
176 | * OK (確認)
177 |
178 | ## Dismiss 「廢棄某想法 / 屏除、遣散某人」
179 |
180 | * 適用於「讓使用者打發掉提示、提醒、警告、錯誤訊息」
181 | * 例如:「__首家線上賭場上線啦!」
182 | * Dismiss (朕知道了)
183 |
184 | ---
185 | # 結語
186 |
187 | 每個人都是從零開始學起的。 :)
188 |
189 | 有任何寫程式時遇到的英文問題,歡迎推文留言。
190 |
191 | 或到《程式英文》討論區提問:
192 |
193 | * GitHub: https://bit.ly/321ResR
194 | * Facebook: https://bit.ly/2EsPmj9
195 |
196 | 這可以幫助我把這知識庫整理得更完善,謝謝 :)
197 |
198 | ---
199 | # *參考* 答案
200 |
201 | 1. clear
202 | 2. empty
203 | 3. delete
204 | 4. remove
205 |
206 | ---
207 | [1]:
208 | https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.collection-1.clear?view=netcore-3.1
209 | [2]:
210 | https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7
211 | [3]:
212 | https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.empty?view=netcore-3.1
213 | [4]:
214 | https://docs.microsoft.com/en-us/dotnet/api/system.io.file.delete?view=netcore-3.1
215 | [5]:
216 | https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.collection-1.remove?view=netcore-3.1
217 | [6]:
218 | https://docs.microsoft.com/en-us/cpp/standard-library/vector-class?view=vs-2019#empty
219 | [7]:
220 | https://docs.microsoft.com/en-us/cpp/standard-library/vector-class?view=vs-2019#clear
221 | [8]:
222 | https://docs.microsoft.com/en-us/cpp/standard-library/vector-class?view=vs-2019#erase
223 | [9]:
224 | https://docs.microsoft.com/en-us/dotnet/api/system.string.empty?view=netcore-3.1
225 | [10]:
226 | https://docs.microsoft.com/en-us/dotnet/api/system.guid.empty?view=netcore-3.1
227 |
228 | ```
229 | --
230 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
231 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1596190126.A.449.html
232 | 推 nyyn: 受教了 推推 07/31 19:05
233 | 推 iceman5566: truncate 表示: 07/31 19:27
234 | 推 lairx: 推 07/31 19:28
235 | 推 CaptPlanet: 推推 07/31 19:54
236 | → newversion: 沒有wipe嗎? 07/31 20:03
237 | → allenxxx: 川普:我都用fire 07/31 21:03
238 | 推 qrtt1: dispose 呢? 07/31 21:11
239 | → Domos: 我個人都用annihilate 07/31 21:44
240 | 推 EntHeEnd: 推 07/31 21:46
241 | 推 mathrew: 我都用 getout 07/31 21:56
242 | 推 alihue: 我都用 kim 07/31 22:10
243 | 推 GGFACE: 我都用kill 07/31 22:17
244 | 推 naestnecniv: 那purge勒 07/31 23:59
245 | 推 FY4: 推 08/01 00:35
246 | → aoisama: drop table users 08/01 01:07
247 | 推 FatSquirrel: 我都用Nuke 08/01 01:38
248 | 推 Bencrie: free release destroy 08/01 02:05
249 | 推 KOD: 推推 08/01 09:49
250 | 推 mybluesky: 讚 08/01 10:12
251 | 推 Esvent: 有時候會用eliminate 08/01 10:12
252 | 推 blueskier: 還沒看 先推個 08/01 11:11
253 |
254 | 謝謝各位的欣賞 :)
255 |
256 | 推文裡提到了不少與「刪除」有關的字,來整理一下我對這些字的「感覺」:
257 |
258 | # 與資料庫 / SQL 有關的
259 |
260 | * drop
261 | * 多見於「刪除資料庫物件」的情景
262 |
263 | * truncate
264 | * 也有用在其它情景,用來表達「截短」的動作
265 | * 相關字 trim 的動作也是「截短」,但更強調「刪除 *多餘的* 東西」
266 |
267 | # 與資源管理有關的
268 |
269 | * 釋放資源
270 | * free
271 | * release
272 |
273 | * dispose 常指「(妥善)處理掉要銷毀的物件」的動作
274 |
275 | # 語氣更強烈的「刪除」
276 |
277 | * destroy
278 | * 有時候 delete 的實作方式是所謂 "soft delete", 會有 undelete 還原的選
279 | 項;而 destroy 暗示著「不可逆的刪除」。
280 |
281 | * purge
282 | * 原意是「暴力強制驅離」,可以想成「強制執行 delete 」
283 |
284 | # 其它
285 |
286 | * kill 常用於「終止 (OS) process (長期、持續運作的流程) 」
287 |
288 | * wipe 與 erase 相似:
289 | * 表示「抹除」資料
290 | * 也多常用在「抹除資料儲存媒體」的情景
291 |
292 | # 相對口語化的用詞
293 |
294 | * annihilate
295 | * eliminate
296 | * nuke
297 |
298 | 其它還有
299 |
300 | * eradicate
301 | * terminate
302 | * obliterate
303 | * expunge
304 |
305 | # 我參不透的梗 XD
306 |
307 | * getout
308 | * kim
309 |
310 | # 要有霸王色霸氣才能用的 XD
311 |
312 | * 龍老母 Daenerys Targaryen: Dracarys!
313 |
314 | * 川普: You are fired!
315 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/01/2020 14:10:11
316 | 推 alihue: kim = 金正恩 08/01 14:37
317 |
318 | XD
319 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/01/2020 14:46:55
320 | → Vitaceae: 儘量用前人的動詞表, 英語能力不適合在這裡發揮 08/01 15:30
321 |
322 | 同意。
323 |
324 | 愈是在公開、可見度高的
325 |
326 | * API 介面
327 | * 使用者介面
328 | * 文件
329 |
330 | 我會愈傾向使用該領域人員常用的術語。
331 |
332 | 推 smart0eddie: 但是empty有些是拿來確認容器是否為空 08/01 17:11
333 | → smart0eddie: 像是c++ std:: vector 08/01 17:11
334 |
335 | 你說的對。
336 |
337 | 我的解讀是,那不像直接利用 empty 在英文中「清空容器內容」的動詞語意;那
338 | 比較像是 IsEmpty() 這樣「測試此容器是否為空(形容詞)」的意思。
339 |
340 | 而就「清空容器內容物」來說, C++ Standard Library 看來也是用 clear 這個
341 | 字。(我猜 clear() 的實作是會去呼叫 erase() )
342 |
343 | 十分感謝你的提醒,我已編輯我的原文,在上面提到 empty, clear, erase 的章
344 | 節都補充了 C++ Standard Library 應用實例,謝謝 :)
345 |
346 | 推 mychiux413: 請問如果一種是丟到垃圾桶可復原的,一種是完全刪除 08/01 17:31
347 | → mychiux413: ,應該用什麼比較妥當? 08/01 17:31
348 |
349 | 這要看情景、需求及此功能的使用者習慣的術語。
350 |
351 | 現代個人電腦使用者大概已經很習慣了「刪除(delete)只是 "soft delete", 刪掉
352 | 的東西還可以從回收筒救回來」這件事。所以不少使用者介面都會特別註明
353 | "permanently delete" 字樣來強調其「不可復原性」。
354 |
355 | 就你描述的情形,或許可以這麼做:
356 |
357 | * 提供 hide / show 功能
358 | * 提供 delete 功能
359 |
360 | 讓使用者看到有 hide, delete 兩種功能,區分其可復原性、不可復原性。
361 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/01/2020 18:47:55
362 | 推 yupog2003: 推推 08/01 18:06
363 |
364 | 謝謝 :)
365 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/01/2020 19:51:07
366 | 推 ms79392002: 覺得你真的很棒 08/02 01:07
367 | 推 siuoly: 推 有學到 08/02 07:34
368 |
369 | 謝謝 :)
370 |
371 | 推 csfgsj: 所以說,寫程式,國文也要好 08/02 08:21
372 |
373 | 同意。
374 |
375 | 目的是溝通,語言是工具,文字是載體。
376 |
377 | 需要依對象、情景來思考怎麼使用語言及文字。
378 |
379 | 例如,機器、使用者、團隊成員、商業人員「想聽的東西」跟「聽得懂的東西」不
380 | 同。
381 |
382 | 而隨著情景時空改變,就算是「剛寫完程式的自己」跟「寫完程式兩週後的自己」
383 | ,「想聽的東西」跟「聽得懂的東西」也不同 XD
384 |
385 | 這的確是需要持續練習精進的題目。
386 |
387 | 推 skizard: 我都用Magic 08/02 08:32
388 |
389 | XD
390 |
391 | 推 hanshsu: prune勒? 08/02 09:43
392 | → HamalAri: virsh: destroy undefine 08/02 11:53
393 |
394 | 很有意思,整理一下我的想法:
395 |
396 | * prune 與上面推文討論中提到的 trim 類似,意指「修剪」。
397 |
398 | * truncate / trim / prune 與 delete 的差別在於: delete 偏向「整個刪除
399 | 」,而 truncate / trim / prune 偏向「消除部分」。
400 |
401 | * destroy 上面推文討論有提到,感覺是「語氣更強烈」、「(暗示)不可逆」的
402 | 刪除。
403 |
404 | * undefine
405 |
406 | 我的 *感覺* 是,這像是 set / unset 的組合。
407 |
408 | undefine 似乎常與 define 一起出現,而少有單獨出現的情形。
409 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/02/2020 14:20:03
410 | 推 wulouise: undefime好像很少用動詞耶,用adj的倒是很多undefined 08/02 20:57
411 |
412 | 同意。
413 |
414 | 推 DCTmaybe: Dismiss 08/02 21:07
415 |
416 | 是的,另外還有 discard, 我的感覺是相對偏向前端設計會使用的字。
417 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/02/2020 21:54:37
418 | 推 unmolk: 推!很受用 08/03 00:32
419 | → unmolk: 現在大二,學資結的時候常常看到實作的function是用remove 08/03 00:32
420 | → unmolk: 或clear常常覺得疑惑,現在終於比較清楚一些了 08/03 00:32
421 |
422 | 如果有其它讓你覺得困惑的單字,請讓我知道 (在這裡推文、站內信、 Facebook
423 | 簡訊、 Twitter 簡訊都可以) ,這可以幫助我把這方面的知識整理得更完善 :)
424 |
425 | * GitHub 討論區 https://bit.ly/321ResR
426 | * Facebook 相簿 https://bit.ly/2EsPmj9
427 | * Twitter 討論 https://bit.ly/2D57pM5
428 |
429 | 推 ian90911: 感謝分享 08/03 10:59
430 |
431 | 不客氣 :)
432 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/03/2020 16:35:58
433 | → APTON: 推!非常感謝 08/04 09:53
434 |
435 | 不客氣 :)
436 |
437 | → APTON: 沒想到當初沒深度的戰文可以引出這麼好的系列文! 08/04 09:53
438 |
439 | > 當初沒深度的戰文
440 |
441 | 這是指哪個討論串? :)
442 |
443 | 我想去看看那討論串裡有沒有可以獨立出來研究的題目。
444 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/04/2020 16:13:53
445 | 推 jack42107: 推 08/06 01:47
446 |
447 | 謝謝 :)
448 |
449 | 推 CoNsTaR: 我都不用刪除,我都直接 YEET!!! 掉 08/07 03:07
450 |
451 | XD
452 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/08/2020 03:10:54
453 | 推 gkkswae: 問 Dracarys適合用在那種程度的清除? 08/08 17:36
454 |
455 | 當你需要把整個資料中心從地圖上消滅的時候? XD
456 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/12/2020 07:49:57
457 | ```
458 |
--------------------------------------------------------------------------------
/notes/2020-08-21-validate-verify.md:
--------------------------------------------------------------------------------
1 | ```
2 | 作者 AmosYang (泛用人型編碼器)
3 | 看板 Soft_Job
4 | 標題 [心得][英文] 如何命名「檢查」功能2
5 | 時間 Fri Aug 21 12:07:06 2020
6 | ```
7 |
8 | 自上週發布「如何命名『檢查』功能」後,收到許多回饋和討論,特別是 Verify,
9 | Validate 之間的比較。
10 |
11 | 這週將深入比較 verify / verification vs. validate / validation 的案例;附
12 | 帶討論 argument vs. parameter 的差別。
13 |
14 | * Google 簡報 https://bit.ly/3l161ey
15 | * GitHub 討論 https://bit.ly/321ResR
16 |
17 | * 如何命名『檢查』功能1
18 | * Google 簡報 https://bit.ly/31UiEPK
19 | * PTT 文章 https://bit.ly/3ixdi3M
20 |
21 | ---
22 | # 「驗證」: Validate vs. Verify 案例比較
23 |
24 | validate 與 verify 的語意非常接近,在非正式的情景多半可以互換使用。
25 |
26 | 這裡,我們將檢視以下案例來試著鑑別 validate 與 verify 在語意上細微的差異:
27 |
28 | * IEEE 1012: Verification and Validation
29 | * IEEE 標準 1012 對 verification 及 validation 的定義
30 |
31 | * validation, verification 在各種情景下的語意、出現頻率
32 |
33 | 感謝參與 https://github.com/EngTW/English-for-Programmers/issues/45 討論
34 | 的網友。
35 |
36 | ---
37 | # IEEE 1012: Verification and Validation
38 |
39 | ## Verification
40 |
41 | 「開發過程可分成多個階段;
42 | 每個階段收尾時,驗證『成品是否滿足此階段的目標?』」
43 |
44 | 也就是驗證「有沒有把東西做對?」,而「對」的定義由該開發階段的「輸入」來
45 | 判斷。
46 |
47 | 例如說:
48 |
49 | * 需求R:「做出整數加法器」
50 |
51 | * 設計階段:輸入需求R,輸出規格書S
52 | * 規格書S會定義整數輸入格式、加法的演算法、如何處理溢位、等等
53 | * 就「設計階段」而言, verification 會驗證「規格書S是否能滿足需求R?」
54 |
55 | * 實作階段:輸入規格書S,輸出程式P
56 | * 程式P會定義程式碼的細節、執行加法、處理例外情形、等等
57 | * 就「實作階段」而言, verification 會驗證「程式P是否能滿足規格書S?」
58 |
59 | ## Validation
60 |
61 | 「開發過程可分成多個階段;
62 | 每個階段收尾時,驗證『成品是否滿足此階段的目的?』」
63 |
64 | 也就是驗證「有沒有做對的東西?」,而「對」的定義由更高層次的整體「目的」
65 | 來判斷。
66 |
67 | 例如說:
68 |
69 | * 需求R:「做出整數加法器」
70 | * validation 驗證內容包括「整體來看,整數加法器真的是最適當的解決方案嗎?」
71 |
72 | * 設計階段:輸入R,輸出規格書S
73 | * validation 驗證內容包括「規格書S開出來的執行條件、技術限制合理嗎?」
74 |
75 | * 實作階段:輸入S,輸出程式P
76 | * validation 驗證內容包括「程式P的使用體驗如何?是否真正解決了使用者的
77 | 問題?」
78 |
79 | ## 參考資料
80 |
81 | * https://en.wikipedia.org/wiki/Verification_and_validation
82 | * https://en.wikipedia.org/wiki/Software_verification_and_validation
83 |
84 | ---
85 | # 「驗證」: Validate vs. Verify 語意 / 出現頻率
86 |
87 | 我們挑選了以下字樣來比較 validation, verification 在各種情景下的語意、出
88 | 現頻率。
89 |
90 | 這些字樣包括程式設計相關字(例如: code, HTML, password ),也有些日常用
91 | 語的字彙(例如: age, identity, signature )。
92 |
93 | * age 年齡
94 | * code 程式碼
95 | * data 資料
96 | * email 電子郵件
97 | * file 檔案
98 | * form 表格
99 | * HTML 超文本標記語言
100 | * identity 身分
101 | * password 密碼
102 | * signature 簽名
103 | * user 使用者
104 |
105 | ## 採樣方式
106 |
107 | * 把以上字樣以 "XXX validation" / "XXX verification" 的形式餵給 Google
108 | * 記錄 Google 傳回的搜尋結果數量
109 | * 歸納 Google 搜尋結果前 3 頁中,該詞的使用情景
110 |
111 | ---
112 | # 驗證 年齡 (age)
113 |
114 | ## Validate / Validation
115 |
116 | Google 搜尋結果數量: 89k
117 |
118 | * 驗證「生物年齡鑑定方法」的準確度
119 | * (極少案例)驗證輸入字串是否為合理的年齡數值
120 | * (極少案例)驗證是否合乎組織、法律規定
121 |
122 | ## Verify / Verification
123 |
124 | Google 搜尋結果數量: 16600k
125 |
126 | * 驗證年齡是否合乎組織、法律規定
127 |
128 | ---
129 | # 驗證 程式碼 (code)
130 |
131 | ## Validate / Validation
132 |
133 | Google 搜尋結果數量: 595k
134 |
135 | * 驗證程式碼、資料是否符合資料格式、語言規格
136 | * JSON, XML, HTML
137 | * 郵遞區號、信用卡號碼
138 |
139 | ## Verify / Verification
140 |
141 | Google 搜尋結果數量: 524k
142 |
143 | * 驗證程式碼實作方法、行為、執行結果是否符合功能規格書
144 |
145 | ---
146 | # 驗證 資料 (data)
147 |
148 | ## Validate / Validation
149 |
150 | Google 搜尋結果數量: 4430k
151 |
152 | * 驗證資料的品質
153 | * 正確性、準確性、一致性、安全性、隱私性、等等
154 | * 格式是否「乾淨」、適合機器處理
155 |
156 | ## Verify / Verification
157 |
158 | Google 搜尋結果數量: 1390k
159 |
160 | * 驗證資料遷移 (migration) 後的正確性
161 |
162 | ## 參考資料
163 |
164 | * https://en.wikipedia.org/wiki/Data_validation
165 | * https://en.wikipedia.org/wiki/Data_verification
166 |
167 | ---
168 | # 驗證 email
169 |
170 | ## Validate / Validation
171 |
172 | Google 搜尋結果數量: 928k
173 |
174 | * 驗證 email 地址的格式
175 | * 驗證 email 是否有效(參考 verification )
176 |
177 | ## Verify / Verification
178 |
179 | Google 搜尋結果數量: 11200k
180 |
181 | * 驗證 email 是否能確實投遞
182 | * 是否會被各家 ISP 的垃圾信過濾機制攔截
183 | * 網域名稱過濾機制、等等
184 |
185 | ---
186 | # 驗證 檔案 (file)
187 |
188 | ## Validate / Validation
189 |
190 | Google 搜尋結果數量: 324k
191 |
192 | * 驗證檔案格式是否符合規格
193 | * PDF, CSV, HTML, JSON, XML, 等等
194 |
195 | ## Verify / Verification
196 |
197 | Google 搜尋結果數量: 152k
198 |
199 | * 驗證檔案內容是否一致
200 | * 驗證檔案內容是否完整 (checksum)
201 | * 驗證檔案來源真偽(數位簽證)
202 |
203 | ## 參考資料
204 |
205 | * https://en.wikipedia.org/wiki/File_verification
206 |
207 | ---
208 | # 驗證 表格 (form)
209 |
210 | ## Validate / Validation
211 |
212 | Google 搜尋結果數量: 2250k
213 |
214 | * 驗證表格資料是否符合規格、是否滿足商業需求
215 | * 必要資訊
216 | * 日期格式
217 | * 信用卡號碼格式
218 | * 電話號碼格式
219 | * …
220 |
221 | ## Verify / Verification
222 |
223 | Google 搜尋結果數量: 54.2k
224 |
225 | * 與 validate / validation 相似
226 |
227 | ---
228 | # 驗證 HTML
229 |
230 | ## Validate / Validation
231 |
232 | Google 搜尋結果數量: 947k
233 |
234 | * 驗證 HTML 資料是否符合規格
235 |
236 | ## Verify / Verification
237 |
238 | Google 搜尋結果數量: 15k
239 |
240 | * 以上傳含有特定內容的 HTML 檔案來驗證網站所有權
241 |
242 | ---
243 | # 驗證 身分 (identity)
244 |
245 | ## Validate / Validation
246 |
247 | Google 搜尋結果數量: 93k
248 |
249 | * 驗證身分資料是否符合規格
250 | * 住址;是否真的有這個地址
251 | * 電話;是否真的有這支電話
252 | * …
253 | * 驗證身分資料是否真實(參考 verification )
254 |
255 | ## Verify / Verification
256 |
257 | Google 搜尋結果數量: 4510k
258 |
259 | * 驗證身分資料是否真實、是否真的能連結到一特定、真實存在的人身上
260 |
261 | ---
262 | # 驗證 密碼 (password)
263 |
264 | ## Validate / Validation
265 |
266 | Google 搜尋結果數量: 423k
267 |
268 | * 驗證密碼是否符合規格
269 | * 英文大小寫、數字、符號……
270 | * 驗證密碼是否正確(參考 verification )
271 |
272 | ## Verify / Verification
273 |
274 | Google 搜尋結果數量: 226k
275 |
276 | * 驗證密碼是否正確
277 |
278 | ---
279 | # 驗證 簽名 (signature)
280 |
281 | ## Validate / Validation
282 |
283 | Google 搜尋結果數量: 144k
284 |
285 | * 說明「由簽名賦與文件法律上的效力」這件事
286 | * 驗證簽名格式、流程、形式是否正確
287 | * 能否滿足「由簽名賦與文件法律上的效力」的條件
288 | * 例如,簽名時有沒有見證人
289 |
290 | ## Verify / Verification
291 |
292 | Google 搜尋結果數量: 2820k
293 |
294 | * 驗證簽名真偽
295 | * 是否真的是當事人的手跡
296 |
297 | ---
298 | # 驗證 使用者 (user)
299 |
300 | ## Validate / Validation
301 |
302 | Google 搜尋結果數量: 242k
303 |
304 | * 跟使用者驗證產品功能性、可用性
305 |
306 | ## Verify / Verification
307 |
308 | Google 搜尋結果數量: 1610k
309 |
310 | * 驗證使用者(帳號)狀態
311 | * 是否為真人
312 | * 使用者帳號帳號信用是否良好
313 |
314 | ---
315 | # 「驗證」: Validate vs. Verify 該用哪個?
316 |
317 | 這兩個字的語意有重疊,在口語上也常交換著用;如果實在不確定,通常可以退一
318 | 步用 "check" ,表達「檢查」的意圖。
319 |
320 | ## Validate 「資料本身是否『有效 (valid) 』」?
321 |
322 | * 資料是否符合形式規格 / 是否在合理範圍內,例如:
323 | * 視地區、文化而定,日期有一定的表示格式
324 | * 年齡不可是負數
325 | * 電子郵件地址必須是 [email protected] 的格式
326 |
327 | * 資料是否完整、準確 / 是否與現實一致,例如:
328 | * 地址是否完整
329 | * 生日日期是否真的存在
330 | * 例如, 2019-02-29 這個日期的格式正確,但事實上不存在
331 |
332 | * (在程式設計以外的情景)過程是否合乎規定程序 / 是否符合整體目的,例如:
333 | * 一份法律文件要有效,除了當事人親筆簽名,可能還需要見證或公證
334 | * "user validation": 產品的設計是否能確實解決使用者的問題
335 |
336 | ## Validate / Verify 「資料、系統是否符合『預期的正確條件、狀態』?」
337 |
338 | * 年齡是否符合組織、法律規定
339 | * 「起始日」是否在「終止日」之前
340 | * 生日日期是否有正式文件背書
341 | * 法律文件上的簽名筆跡是否為真
342 | * 是否為見證人 / 公證人認同
343 |
344 | ---
345 | # 引數 Argument 參數 Parameter 的差別
346 |
347 | 從 Google 可以找到前人留下的答案:
348 |
349 | * 方法、函數宣告的 是 參數 (parameter)
350 | * 傳入方法、函數的 是 引數 (argument)
351 |
352 | 例如:
353 |
354 | ```
355 | function foo(parameter) { … }
356 | foo(argument)
357 | ```
358 |
359 | 一篇 "Kt. Academy" 的文章也點出,可以把相似的概念應用在類別(type)上,例如:
360 |
361 | ```
362 | class Bar …
363 | val baz: Bar …
364 | ```
365 |
366 | 那麼,為什麼參數是參數、引數是引數?
367 |
368 | 我們可以從語源學找到線索:
369 |
370 | * argument 是從 1300 年代的「根據、證據;推論」而來,帶有「『可從其推導出
371 | 別的觀念』的觀念」的意思。
372 |
373 | * parameter 在 1920 - 1950 年代逐漸開始含有「幫助定義系統特性的可測量因素」
374 | 的意思。
375 |
376 | 一篇 MDSN 文章提供了很有趣的理解方式:
377 |
378 | > You can think of the parameter as a parking space and the argument as
379 | > an automobile. Just as different automobiles can park in a parking
380 | > space at different times, the calling code can pass a different
381 | > argument to the same parameter every time that it calls the procedure.
382 |
383 | 「你可以把參數(parameter)想成停車位(parking space),把引數(argument)想成
384 | 汽車(automobile)。就像不同的汽車在不同的時間可樣停在同一個停車位上,程式
385 | 碼每次呼叫函式的時候,可以傳送給函式參數不同的引數。」
386 |
387 | ## 參考資料
388 |
389 | * https://softwareengineering.stackexchange.com/questions/186293/why-are-actual-parameters-called-arguments
390 | * https://blog.kotlin-academy.com/programmer-dictionary-parameter-vs-argument-type-parameter-vs-type-argument-b965d2cc6929
391 | * https://www.etymonline.com/word/parameter
392 | * https://www.etymonline.com/word/argument
393 | * https://stackoverflow.com/questions/1788923/parameter-vs-argument/1788926#comment43458658_1788923
394 | * https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/differences-between-parameters-and-arguments
395 |
396 | 感謝在 https://github.com/EngTW/English-for-Programmers/issues/31 參與討
397 | 論的網友。
398 |
399 | ---
400 | # 結語
401 |
402 | 如果有軟體工程、程式設計相關的英文問題,歡迎推文提問,或著到《程式英文》
403 | GitHub 討論區留言。
404 |
405 | * https://bit.ly/321ResR
406 | * https://github.com/EngTW/English-for-Programmers/issues
407 |
408 | 大家集思廣益、切磋砥礪,增強英文語感,提昇程式可讀性。 :)
409 |
410 | ```
411 | --
412 | ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 136.56.13.184 (美國)
413 | ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1597982849.A.9A7.html
414 | 推 sniper2824: 先推 08/21 12:16
415 | 推 jobintan: nice. 08/21 12:20
416 | 推 jerryshadow: 先推 08/21 12:27
417 | 推 javy0521: 推 08/21 12:50
418 | 推 hans1461: 推 08/21 13:26
419 | 推 summerleaves: 推 08/21 14:36
420 | 推 BlazarArc: 推 08/21 15:18
421 | 推 TWkobe: 謝謝 很實用 08/21 15:53
422 | 推 minesos520: push 08/21 16:30
423 |
424 | 謝謝 :)
425 |
426 | 推 ayugioh2003: 推 參數引數那段好懂又好記 08/21 21:45
427 |
428 | 謝謝你的欣賞 :)
429 |
430 | 推 Ouranos: 推推! 08/21 22:19
431 | 推 LIN810116: 推 08/22 04:37
432 | 推 sksksk0487: 推 08/22 13:38
433 |
434 | 謝謝 :)
435 |
436 | 推 Csongs: 所以verify包含validation 08/22 13:54
437 |
438 | 我是這樣看,先重新檢視字典的定義:
439 |
440 | ---
441 | ## validate
442 |
443 | > check or prove the validity or accuracy of (something).
444 |
445 | 檢查、證明某事物的 有效性 或 準確性
446 |
447 | > demonstrate or support the truth or value of.
448 |
449 | 展示、支持某人事物的確實性、 (精神上的) 價值
450 |
451 | > make or declare legally valid.
452 |
453 | 宣告、認可某事物 在法律上的有效性
454 |
455 | > recognize or affirm the validity or worth of (a person or their
456 | > feelings or opinions); cause (a person) to feel valued or worthwhile.
457 |
458 | 認可、確性某人 (或它的感受、意見) 的 有效性、 (精神上的) 價值
459 |
460 | ## verify
461 |
462 | > make sure or demonstrate that (something) is true, accurate, or justified.
463 |
464 | 確認、展示某事物為真、準確、合理
465 |
466 | > LAW
467 | > swear to or support (a statement) by affidavit.
468 |
469 | 法律上,以宣誓為某主張背書
470 |
471 | ---
472 | 把這兩個字最主要的解釋並排在一起看,可以看出為什麼那麼難分辨
473 |
474 | * validate
475 | * 檢查、證明某事物的 有效性(validity) 或 準確性
476 | * validity
477 | * > the quality of being logically or factually sound; soundness or
478 | > cogency.
479 | * 邏輯上、事實上 合理明確一致 ,讓人信服
480 | * > the state of being legally or officially binding or acceptable.
481 | * 在法律上 或 正式地 有效/被接受
482 | * verify
483 | * 確認、展示某事物為真、準確、合理
484 |
485 | 也就是說,隨著上下文脈絡對「有效性、準確性、真實性、合理性」的解讀的改變
486 | ,在 口語 上,這兩個字多半可以互換著用。
487 |
488 | (有點事,先離開,等等再回來寫完)
489 |
490 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/22/2020 21:27:14
491 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/22/2020 21:58:41
492 |
493 | 回到原題
494 |
495 | > 所以verify包含validation
496 |
497 | 與其說「包含」,我會這樣想:
498 |
499 | * 如果你選擇把「此資料是否有效」與「此資料是否滿足預期的正確狀態」分開來
500 | 看,那麼,
501 |
502 | * `bool ValidateAge(string age)` 可以做「判斷 age 資料是否有效」;例如
503 | , "-3", "foobar" 會是「無效的年齡資料」。
504 |
505 | * `bool VerifyAge(int age)` 可以做「判斷是否符合『對年齡的規定』」;例如
506 | 12 (歲) 就不符合「成人 18 歲的規定」。
507 |
508 | * 相對的,如果在你的邏輯模型中你認為「『大於 18 的數字』才是
509 | 有效(valid)的 + 正確的 + 合理的」,也是可以用一個 `ValidateAge()`
510 | 或 `VerifyAge()` 就一次檢查完。
511 |
512 | 或著,寫成 `CheckAge()` 也可以,大多數人應該還是能知道你的意圖是「檢查
513 | age 是否符合你的邏輯模型的要求。
514 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/23/2020 13:54:00
515 | 推 Csongs: 年齡舉例 蠻清楚的 謝謝 08/24 09:41
516 |
517 | 不客氣 :)
518 | ※ 編輯: AmosYang (136.56.13.184 美國), 08/29/2020 06:30:00
519 | ```
520 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CleanData/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text.Json;
5 | using Common;
6 |
7 | namespace CleanData
8 | {
9 | class Program
10 | {
11 | public const char Delimiter = ' ';
12 |
13 | static void Main(string[] arguments)
14 | {
15 | switch (arguments.Length)
16 | {
17 | case 0: throw new ArgumentException($"Missing {nameof(arguments)}[0]: input-file-path.", nameof(arguments));
18 | case 1: throw new ArgumentException($"Missing {nameof(arguments)}[1]: output-file-path.", nameof(arguments));
19 | }
20 |
21 | var inputFilePath = arguments[0];
22 | var inputReader = new RawDataReader(inputFilePath);
23 |
24 | const int knownWordDataCount = 6012;
25 | var wordDataList = new List(knownWordDataCount);
26 |
27 | {
28 | inputReader.SkipLineWhile(line => !line.StartsWith("依字母排序 A"));
29 | inputReader.SkipLine(); // Line 6409: 依字母排序 A
30 | wordDataList.AddRange(inputReader.ReadWordData(113));
31 | inputReader.SkipLine(); // Line 6638: 高中英文參考詞彙表
32 | inputReader.SkipLine(); // Line 6639: 54
33 | wordDataList.AddRange(inputReader.ReadWordData(119));
34 | inputReader.SkipLine(); // Line 6760: 依字母排序 A
35 | inputReader.SkipLine(); // Line 6761: 55
36 | wordDataList.AddRange(inputReader.ReadWordData(119));
37 | inputReader.SkipLine(); // Line 6882: 高中英文參考詞彙表
38 | inputReader.SkipLine(); // Line 6883: 56
39 | wordDataList.AddRange(inputReader.ReadWordData(40));
40 | inputReader.SkipLine(); // Line 6924: B
41 | wordDataList.AddRange(inputReader.ReadWordData(78));
42 | inputReader.SkipLine(); // Line 7004: 依字母排序 B
43 | inputReader.SkipLine(); // Line 7005: 57
44 | wordDataList.AddRange(inputReader.ReadWordData(120));
45 | inputReader.SkipLine(); // Line 7126: 高中英文參考詞彙表
46 | inputReader.SkipLine(); // Line 7127: 58
47 | wordDataList.AddRange(inputReader.ReadWordData(114));
48 | inputReader.SkipLine(); // Line 7242: C
49 | wordDataList.AddRange(inputReader.ReadWordData(5));
50 | inputReader.SkipLine(); // Line 7248: 依字母排序
51 | inputReader.SkipLine(); // Line 7249: C
52 | inputReader.SkipLine(); // Line 7250: 59
53 | wordDataList.AddRange(inputReader.ReadWordData(113));
54 |
55 | {
56 | // Line 7477
57 |
58 | // chairperson/chair/
59 | // chairman/
60 | // chairwoman n.
61 | // 6
62 |
63 | var line = string.Concat(inputReader.ReadLine(3));
64 | var tokens = line.Split(Delimiter);
65 | var level = inputReader.ReadLine();
66 | wordDataList.Add(new(tokens[0], tokens[1], level));
67 | }
68 |
69 | wordDataList.AddRange(inputReader.ReadWordData(4));
70 | inputReader.SkipLine(); // Line 7489: 高中英文參考詞彙表
71 | inputReader.SkipLine(); // Line 7490: 60
72 | wordDataList.AddRange(inputReader.ReadWordData(120));
73 | inputReader.SkipLine(); // Line 7611: 依字母排序 C
74 | inputReader.SkipLine(); // Line 7612: 61
75 | wordDataList.AddRange(inputReader.ReadWordData(120));
76 | inputReader.SkipLine(); // Line 7733: 高中英文參考詞彙表
77 | inputReader.SkipLine(); // Line 7734: 62
78 | wordDataList.AddRange(inputReader.ReadWordData(55));
79 |
80 | {
81 | // Line 7790
82 |
83 | // congressman/
84 | // congresswoman n. 6
85 |
86 | var line = string.Concat(inputReader.ReadLine(2));
87 | var tokens = line.Split(Delimiter);
88 | wordDataList.Add(new(tokens[0], tokens[1], tokens[2]));
89 | }
90 |
91 | wordDataList.AddRange(inputReader.ReadWordData(63));
92 | inputReader.SkipLine(); // Line 7855: 依字母排序 C
93 | inputReader.SkipLine(); // Line 7856: 63
94 | wordDataList.AddRange(inputReader.ReadWordData(120));
95 | inputReader.SkipLine(); // Line 7977: 高中英文參考詞彙表
96 | inputReader.SkipLine(); // Line 7978: 64
97 | wordDataList.AddRange(inputReader.ReadWordData(56));
98 | inputReader.SkipLine(); // Line 8091: D
99 | wordDataList.AddRange(inputReader.ReadWordData(63));
100 | inputReader.SkipLine(); // Line 8218: 依字母排序 D
101 | inputReader.SkipLine(); // Line 8219: 65
102 | wordDataList.AddRange(inputReader.ReadWordData(120));
103 | inputReader.SkipLine(); // Line 8340: 高中英文參考詞彙表
104 | inputReader.SkipLine(); // Line 8341: 66
105 | wordDataList.AddRange(inputReader.ReadWordData(119));
106 | inputReader.SkipLine(); // Line 8462: 依字母排序 E
107 | inputReader.SkipLine(); // Line 8463: 67
108 | wordDataList.AddRange(inputReader.ReadWordData(73));
109 | inputReader.SkipLine(); // Line 8538: E
110 | wordDataList.AddRange(inputReader.ReadWordData(45));
111 | inputReader.SkipLine(); // Line 8584: 高中英文參考詞彙表
112 | inputReader.SkipLine(); // Line 8585: 68
113 | wordDataList.AddRange(inputReader.ReadWordData(120));
114 | inputReader.SkipLine(); // Line 8706: 依字母排序 F
115 | inputReader.SkipLine(); // Line 8707: 69
116 | wordDataList.AddRange(inputReader.ReadWordData(111));
117 | inputReader.SkipLine(); // Line 8820: F
118 | wordDataList.AddRange(inputReader.ReadWordData(7));
119 | inputReader.SkipLine(); // Line 8828: 高中英文參考詞彙表
120 | inputReader.SkipLine(); // Line 8829: 70
121 | wordDataList.AddRange(inputReader.ReadWordData(120));
122 | inputReader.SkipLine(); // Line 8950: 依字母排序 F
123 | inputReader.SkipLine(); // Line 8951: 71
124 | wordDataList.AddRange(inputReader.ReadWordData(120));
125 | inputReader.SkipLine(); // Line 9072: 高中英文參考詞彙表
126 | inputReader.SkipLine(); // Line 9073: 72
127 | wordDataList.AddRange(inputReader.ReadWordData(22));
128 | inputReader.SkipLine(); // Line 9118: G
129 | wordDataList.AddRange(inputReader.ReadWordData(97));
130 | inputReader.SkipLine(); // Line 9313: 依字母排序 H
131 | inputReader.SkipLine(); // Line 9314: 73
132 | wordDataList.AddRange(inputReader.ReadWordData(74));
133 | inputReader.SkipLine(); // Line 9389: H
134 | wordDataList.AddRange(inputReader.ReadWordData(45));
135 | inputReader.SkipLine(); // Line 9435: 高中英文參考詞彙表
136 | inputReader.SkipLine(); // Line 9436: 74
137 | wordDataList.AddRange(inputReader.ReadWordData(12));
138 |
139 | {
140 | // Line 9449
141 |
142 | // he (him, his, himself)
143 | // pron. 1
144 |
145 | var word = inputReader.ReadLine();
146 | var line = inputReader.ReadLine();
147 | var tokens = line.Split(Delimiter);
148 | wordDataList.Add(new(word, tokens[0], tokens[1]));
149 | }
150 |
151 | wordDataList.AddRange(inputReader.ReadWordData(105));
152 | inputReader.SkipLine(); // Line 9557: 依字母排序 I
153 | inputReader.SkipLine(); // Line 9558: 75
154 | wordDataList.AddRange(inputReader.ReadWordData(42));
155 | inputReader.SkipLine(); // Line 9601: I
156 |
157 | {
158 | // Line 9602
159 |
160 | // I (me, my, mine, myself)
161 | // pron. 1
162 |
163 | var word = inputReader.ReadLine();
164 | var line = inputReader.ReadLine();
165 | var tokens = line.Split(Delimiter);
166 | wordDataList.Add(new(word, tokens[0], tokens[1]));
167 | }
168 |
169 | wordDataList.AddRange(inputReader.ReadWordData(75));
170 | inputReader.SkipLine(); // Line 9679: 高中英文參考詞彙表
171 | inputReader.SkipLine(); // Line 9680: 76
172 | wordDataList.AddRange(inputReader.ReadWordData(120));
173 | inputReader.SkipLine(); // Line 9801: 依字母排序
174 | inputReader.SkipLine(); // Line 9802: J
175 | inputReader.SkipLine(); // Line 9803: 77
176 | wordDataList.AddRange(inputReader.ReadWordData(36));
177 |
178 | {
179 | // Line 9876
180 |
181 | // it (its, itself) pron.
182 | // 1
183 |
184 | var line = inputReader.ReadLine();
185 | var word = line.Substring(0, 16);
186 | var partOfSpeech = line.Substring(17);
187 | var level = inputReader.ReadLine();
188 | wordDataList.Add(new(word, partOfSpeech, level));
189 | }
190 |
191 | wordDataList.AddRange(inputReader.ReadWordData(4));
192 | inputReader.SkipLine(); // Line 9886: J
193 | wordDataList.AddRange(inputReader.ReadWordData(48));
194 | inputReader.SkipLine(); // Line 9982: K
195 | wordDataList.AddRange(inputReader.ReadWordData(28));
196 | inputReader.SkipLine(); // Line 10039: 高中英文參考詞彙表
197 | inputReader.SkipLine(); // Line 10040: 78
198 | wordDataList.AddRange(inputReader.ReadWordData(9));
199 | inputReader.SkipLine(); // Line 10059: L
200 | wordDataList.AddRange(inputReader.ReadWordData(110));
201 | inputReader.SkipLine(); // Line 10280: 依字母排序
202 | inputReader.SkipLine(); // Line 10281: M
203 | inputReader.SkipLine(); // Line 10282: 79
204 | wordDataList.AddRange(inputReader.ReadWordData(104));
205 | inputReader.SkipLine(); // Line 10491: M
206 | wordDataList.AddRange(inputReader.ReadWordData(15));
207 | inputReader.SkipLine(); // Line 10522: 高中英文參考詞彙表
208 | inputReader.SkipLine(); // Line 10523: 80
209 | wordDataList.AddRange(inputReader.ReadWordData(119));
210 | inputReader.SkipLine(); // Line 10644: 依字母排序 M
211 | inputReader.SkipLine(); // Line 10645: 81
212 | wordDataList.AddRange(inputReader.ReadWordData(120));
213 | inputReader.SkipLine(); // Line 10766: 高中英文參考詞彙表
214 | inputReader.SkipLine(); // Line 10767: 82
215 | wordDataList.AddRange(inputReader.ReadWordData(47));
216 | inputReader.SkipLine(); // Line 10862: N
217 | wordDataList.AddRange(inputReader.ReadWordData(43));
218 |
219 | {
220 | // Line 10949
221 |
222 | // neither adj./adv./pron./
223 | // conj.
224 | // 2
225 |
226 | var line = string.Concat(inputReader.ReadLine(2));
227 | var tokens = line.Split(Delimiter);
228 | var level = inputReader.ReadLine();
229 | wordDataList.Add(new(tokens[0], tokens[1], level));
230 | }
231 |
232 | wordDataList.AddRange(inputReader.ReadWordData(27));
233 | inputReader.SkipLine(); // Line 11006: 依字母排序 O
234 | inputReader.SkipLine(); // Line 11007: 83
235 | wordDataList.AddRange(inputReader.ReadWordData(43));
236 | inputReader.SkipLine(); // Line 11051: O
237 | wordDataList.AddRange(inputReader.ReadWordData(74));
238 | inputReader.SkipLine(); // Line 11128: 高中英文參考詞彙表
239 | inputReader.SkipLine(); // Line 11129: 84
240 | wordDataList.AddRange(inputReader.ReadWordData(88));
241 | inputReader.SkipLine(); // Line 11306: P
242 | wordDataList.AddRange(inputReader.ReadWordData(31));
243 | inputReader.SkipLine(); // Line 11369: 依字母排序 P
244 | inputReader.SkipLine(); // Line 11370: 85
245 | wordDataList.AddRange(inputReader.ReadWordData(120));
246 | inputReader.SkipLine(); // Line 11491: 高中英文參考詞彙表
247 | inputReader.SkipLine(); // Line 11492: 86
248 | wordDataList.AddRange(inputReader.ReadWordData(120));
249 | inputReader.SkipLine(); // Line 11613: 依字母排序 P
250 | inputReader.SkipLine(); // Line 11614: 87
251 | wordDataList.AddRange(inputReader.ReadWordData(120));
252 | inputReader.SkipLine(); // Line 11735: 高中英文參考詞彙表
253 | inputReader.SkipLine(); // Line 11736: 88
254 | wordDataList.AddRange(inputReader.ReadWordData(98));
255 | inputReader.SkipLine(); // Line 11933: Q
256 | wordDataList.AddRange(inputReader.ReadWordData(21));
257 | inputReader.SkipLine(); // Line 11976: 依字母排序
258 | inputReader.SkipLine(); // Line 11977: R
259 | inputReader.SkipLine(); // Line 11978: 89
260 | wordDataList.AddRange(inputReader.ReadWordData(1));
261 | inputReader.SkipLine(); // Line 11981: R
262 | wordDataList.AddRange(inputReader.ReadWordData(118));
263 | inputReader.SkipLine(); // Line 12218: 高中英文參考詞彙表
264 | inputReader.SkipLine(); // Line 12219: 90
265 | wordDataList.AddRange(inputReader.ReadWordData(120));
266 | inputReader.SkipLine(); // Line 12340: 依字母排序 S
267 | inputReader.SkipLine(); // Line 12341: 91
268 | wordDataList.AddRange(inputReader.ReadWordData(100));
269 | inputReader.SkipLine(); // Line 12442: S
270 | wordDataList.AddRange(inputReader.ReadWordData(14));
271 |
272 | {
273 | // Line 12457
274 |
275 | // salesperson/salesman/
276 | // saleswoman n. 2
277 |
278 | var line = string.Concat(inputReader.ReadLine(2));
279 | var tokens = line.Split(Delimiter);
280 | wordDataList.Add(new(tokens[0], tokens[1], tokens[2]));
281 | }
282 |
283 | wordDataList.AddRange(inputReader.ReadWordData(3));
284 | inputReader.SkipLine(); // Line 12462: 高中英文參考詞彙表
285 | inputReader.SkipLine(); // Line 12463: 92
286 | wordDataList.AddRange(inputReader.ReadWordData(120));
287 | inputReader.SkipLine(); // Line 12584: 依字母排序 S
288 | inputReader.SkipLine(); // Line 12585: 93
289 | wordDataList.AddRange(inputReader.ReadWordData(36));
290 |
291 | {
292 | // Line 12622
293 |
294 | // she (her, hers, herself)
295 | // pron. 1
296 |
297 | var word = inputReader.ReadLine();
298 | var line = inputReader.ReadLine();
299 | var tokens = line.Split(Delimiter);
300 | wordDataList.Add(new(word, tokens[0], tokens[1]));
301 | }
302 |
303 | wordDataList.AddRange(inputReader.ReadWordData(82));
304 | inputReader.SkipLine(); // Line 12706: 高中英文參考詞彙表
305 | inputReader.SkipLine(); // Line 12707: 94
306 | wordDataList.AddRange(inputReader.ReadWordData(119));
307 | inputReader.SkipLine(); // Line 12828: 依字母排序 S
308 | inputReader.SkipLine(); // Line 12829: 95
309 | wordDataList.AddRange(inputReader.ReadWordData(66));
310 |
311 | {
312 | // Line 12897
313 |
314 | // spokesperson/
315 | // spokesman/
316 | // spokeswoman n. 6
317 |
318 | var line = string.Concat(inputReader.ReadLine(3));
319 | var tokens = line.Split(Delimiter);
320 | wordDataList.Add(new(tokens[0], tokens[1], tokens[2]));
321 | }
322 |
323 | wordDataList.AddRange(inputReader.ReadWordData(6));
324 |
325 | {
326 | // Line 12906
327 |
328 | // sportsman/sportswoma
329 | // n n. 6
330 |
331 | var line = string.Concat(inputReader.ReadLine(2));
332 | var tokens = line.Split(Delimiter);
333 | wordDataList.Add(new(tokens[0], tokens[1], tokens[2]));
334 | }
335 |
336 | wordDataList.AddRange(inputReader.ReadWordData(43));
337 | inputReader.SkipLine(); // Line 12951: 高中英文參考詞彙表
338 | inputReader.SkipLine(); // Line 12952: 96
339 | wordDataList.AddRange(inputReader.ReadWordData(114));
340 |
341 | {
342 | // Line 13067
343 |
344 | // subway/underground/
345 | // metro n. 2
346 |
347 | var line = string.Concat(inputReader.ReadLine(2));
348 | var tokens = line.Split(Delimiter);
349 | wordDataList.Add(new(tokens[0], tokens[1], tokens[2]));
350 | }
351 |
352 | wordDataList.AddRange(inputReader.ReadWordData(4));
353 | inputReader.SkipLine(); // Line 13073: 依字母排序 T
354 | inputReader.SkipLine(); // Line 13074: 97
355 | wordDataList.AddRange(inputReader.ReadWordData(106));
356 | inputReader.SkipLine(); // Line 13181: T
357 | wordDataList.AddRange(inputReader.ReadWordData(13));
358 | inputReader.SkipLine(); // Line 13195: 高中英文參考詞彙表
359 | inputReader.SkipLine(); // Line 13196: 98
360 | wordDataList.AddRange(inputReader.ReadWordData(89));
361 |
362 | {
363 | // Line 13286
364 |
365 | // they (them, their,
366 | // theirs, themselves)
367 | // pron. 1
368 |
369 | var word = string.Join(Delimiter, inputReader.ReadLine(2));
370 | var line = inputReader.ReadLine();
371 | var tokens = line.Split(Delimiter);
372 | wordDataList.Add(new(word, tokens[0], tokens[1]));
373 | }
374 |
375 | wordDataList.AddRange(inputReader.ReadWordData(28));
376 | inputReader.SkipLine(); // Line 13317: 依字母排序 T
377 | inputReader.SkipLine(); // Line 13318: 99
378 | wordDataList.AddRange(inputReader.ReadWordData(120));
379 | inputReader.SkipLine(); // Line 13439: 高中英文參考詞彙表
380 | inputReader.SkipLine(); // Line 13440: 100
381 | wordDataList.AddRange(inputReader.ReadWordData(58));
382 | inputReader.SkipLine(); // Line 13499: U
383 | wordDataList.AddRange(inputReader.ReadWordData(60));
384 | inputReader.SkipLine(); // Line 13561: 依字母排序
385 | inputReader.SkipLine(); // Line 13562: V
386 | inputReader.SkipLine(); // Line 13563: 101
387 | wordDataList.AddRange(inputReader.ReadWordData(8));
388 | inputReader.SkipLine(); // Line 13580: V
389 | wordDataList.AddRange(inputReader.ReadWordData(105));
390 | inputReader.SkipLine(); // Line 13791: W
391 | wordDataList.AddRange(inputReader.ReadWordData(5));
392 | inputReader.SkipLine(); // Line 13802: 高中英文參考詞彙表
393 | inputReader.SkipLine(); // Line 13803: 102
394 | wordDataList.AddRange(inputReader.ReadWordData(30));
395 |
396 | {
397 | // Line 13834
398 |
399 | // we (us, our, ours,
400 | // ourselves) pron. 1
401 |
402 | var line = string.Join(Delimiter, inputReader.ReadLine(2));
403 | var word = line.Substring(0, 29);
404 | var tokens = line.Substring(30).Split(Delimiter);
405 | wordDataList.Add(new(word, tokens[0], tokens[1]));
406 | }
407 |
408 | wordDataList.AddRange(inputReader.ReadWordData(88));
409 | inputReader.SkipLine(); // Line 13924: 依字母排序
410 | inputReader.SkipLine(); // Line 13925: Y
411 | inputReader.SkipLine(); // Line 13926: 103
412 | wordDataList.AddRange(inputReader.ReadWordData(42));
413 | inputReader.SkipLine(); // Line 14011: Y
414 | wordDataList.AddRange(inputReader.ReadWordData(16));
415 |
416 | {
417 | // Line 14044
418 |
419 | // you (your, yours,
420 | // yourself, yourselves)
421 | // pron.
422 | // 1
423 |
424 | var word = string.Join(Delimiter, inputReader.ReadLine(2));
425 | var partOfSpeech = inputReader.ReadLine();
426 | var level = inputReader.ReadLine();
427 | wordDataList.Add(new(word, partOfSpeech, level));
428 | }
429 |
430 | wordDataList.AddRange(inputReader.ReadWordData(4));
431 | inputReader.SkipLine(); // Line 14056: Z
432 | wordDataList.AddRange(inputReader.ReadWordData(6));
433 | }
434 |
435 | var outputFilePath = arguments[1];
436 | var wordDataJson = JsonSerializer.Serialize(wordDataList);
437 | File.WriteAllText(outputFilePath, wordDataJson);
438 | }
439 | }
440 | }
441 |
--------------------------------------------------------------------------------
/lists/Taiwan-high-school-6K-108-edition/Code/CompileData/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text.Json;
6 | using Common;
7 |
8 | namespace CompileData
9 | {
10 | class Program
11 | {
12 | public static readonly char[] Delimiters = { ' ', ',', '(', ')', '/' };
13 |
14 | static void Main(string[] arguments)
15 | {
16 | switch (arguments.Length)
17 | {
18 | case 0: throw new ArgumentException($"Missing {nameof(arguments)}[0]: input-file-path.", nameof(arguments));
19 | case 1: throw new ArgumentException($"Missing {nameof(arguments)}[1]: output-file-path.", nameof(arguments));
20 | }
21 |
22 | var inputFilePath = arguments[0];
23 | var inputReader = new WordDataReader(inputFilePath);
24 |
25 | const int knownWordInfoCount = 6183;
26 | var wordInfoList = new List(knownWordInfoCount);
27 |
28 | {
29 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = a/an, PartOfSpeech = art., Level = 1 }
30 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(41));
31 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = accomplish(ment), PartOfSpeech = v./(n.), Level = 4 }
32 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(15));
33 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = achieve(ment), PartOfSpeech = v./(n.), Level = 3 }
34 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
35 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = acknowledge(ment), PartOfSpeech = v./(n.), Level = 5 }
36 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(12));
37 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = actor/actress, PartOfSpeech = n., Level = 1 }
38 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(11));
39 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = adjust(ment), PartOfSpeech = v./(n.), Level = 4 }
40 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = administer/administrate, PartOfSpeech = v., Level = 6 }
41 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(19));
42 |
43 | {
44 | // WordData { Word = advertise(ment)/ad, PartOfSpeech = v./(n.), Level = 3 }
45 |
46 | var wordData = inputReader.ReadWordData();
47 | var wordTokens = wordData.Word.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
48 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
49 | wordInfoList.Add(new(wordTokens[0], new[] { partOfSpeechTokens[0] }, wordData.Level));
50 | wordInfoList.Add(new(wordTokens[0] + wordTokens[1], new[] { partOfSpeechTokens[1] }, wordData.Level));
51 | wordInfoList.Add(new(wordTokens[2], new[] { partOfSpeechTokens[1] }, wordData.Level));
52 | }
53 |
54 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(2));
55 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = adviser/advisor, PartOfSpeech = n., Level = 3 }
56 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
57 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = afterward/afterwards, PartOfSpeech = adv., Level = 3 }
58 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
59 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = agree(ment), PartOfSpeech = v./(n.), Level = 1 }
60 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(9));
61 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = airplane/plane, PartOfSpeech = n., Level = 1 }
62 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(43));
63 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = am/a.m., PartOfSpeech = adv., Level = 1 }
64 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
65 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = amaze(ment), PartOfSpeech = v./(n.), Level = 3 }
66 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(7));
67 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = amid/amidst, PartOfSpeech = prep., Level = 6 }
68 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(4));
69 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = amuse(ment), PartOfSpeech = v./(n.), Level = 4 }
70 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(17));
71 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = announce(ment), PartOfSpeech = v./(n.), Level = 3 }
72 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(16));
73 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = anybody/anyone, PartOfSpeech = pron., Level = 1 }
74 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(4));
75 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = anywhere/anyplace, PartOfSpeech = adv., Level = 2 }
76 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(18));
77 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = appoint(ment), PartOfSpeech = v./(n.), Level = 4 }
78 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(18));
79 |
80 | {
81 | // WordData { Word = argue(argument), PartOfSpeech = v./(n.), Level = 2 }
82 |
83 | var wordData = inputReader.ReadWordData();
84 | var wordTokens = wordData.Word.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
85 | var partOfSpeechTokens = wordData.PartOfSpeech.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
86 | wordInfoList.Add(new(wordTokens[0], new[] { partOfSpeechTokens[0] }, wordData.Level));
87 | wordInfoList.Add(new(wordTokens[1], new[] { partOfSpeechTokens[1] }, wordData.Level));
88 | }
89 |
90 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(8));
91 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = arrange(ment), PartOfSpeech = v./(n.), Level = 2 }
92 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(28));
93 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = assess(ment), PartOfSpeech = v./(n.), Level = 5 }
94 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
95 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = assign(ment), PartOfSpeech = v./(n.), Level = 4 }
96 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
97 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = astonish(ment), PartOfSpeech = v./(n.), Level = 5 }
98 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(11));
99 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = attach(ment), PartOfSpeech = v./(n.), Level = 4 }
100 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
101 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = attain(ment), PartOfSpeech = v./(n.), Level = 6 }
102 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(25));
103 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = automobile/auto, PartOfSpeech = n., Level = 3 }
104 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(25));
105 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = backward/backwards, PartOfSpeech = adv., Level = 2 }
106 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(118));
107 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = bicycle/bike, PartOfSpeech = n., Level = 1 }
108 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(33));
109 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = blond/blonde, PartOfSpeech = n./adj., Level = 6 }
110 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(64));
111 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = brassiere/bra, PartOfSpeech = n., Level = 6 }
112 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(17));
113 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = bridegroom/groom, PartOfSpeech = n., Level = 4 }
114 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(72));
115 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = café/cafe, PartOfSpeech = n., Level = 2 }
116 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(11));
117 |
118 | {
119 | // WordData { Word = calm, PartOfSpeech = v./adj./n, Level = 2 }
120 |
121 | var wordData = inputReader.ReadWordData();
122 | var partOfSpeechTokens = (wordData.PartOfSpeech + ".").Split(Delimiters);
123 | wordInfoList.Add(new(wordData.Word, partOfSpeechTokens, wordData.Level));
124 | }
125 |
126 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(22));
127 |
128 | {
129 | // WordData { Word = capital(ism), PartOfSpeech = n., Level = 4 }
130 |
131 | var wordData = inputReader.ReadWordData();
132 | var wordTokens = wordData.Word.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
133 | wordInfoList.Add(new(wordTokens[0], new[] { wordData.PartOfSpeech }, wordData.Level));
134 | wordInfoList.Add(new(wordTokens[0] + wordTokens[1], new[] { wordData.PartOfSpeech }, wordData.Level));
135 | }
136 |
137 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(78));
138 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = chairperson/chair/chairman/chairwoman, PartOfSpeech = n., Level = 6 }
139 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(62));
140 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = chopstick(s), PartOfSpeech = n., Level = 2 }
141 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(84));
142 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = cockroach/roach, PartOfSpeech = n., Level = 2 }
143 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
144 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = cola/Coke, PartOfSpeech = n., Level = 2 }
145 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(28));
146 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = comic(s), PartOfSpeech = adj./n., Level = 2 }
147 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(109));
148 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = congratulation(s), PartOfSpeech = n., Level = 2 }
149 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
150 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = congressman/congresswoman, PartOfSpeech = n., Level = 6 }
151 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(49));
152 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = content(ment), PartOfSpeech = v./(n.), Level = 4 }
153 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(132));
154 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = criterion/criteria, PartOfSpeech = n., Level = 5 }
155 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(197));
156 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = develop(ment), PartOfSpeech = v./(n.), Level = 2 }
157 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(62));
158 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = disagree(ment), PartOfSpeech = v./(n.), Level = 2 }
159 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
160 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = disappoint(ment), PartOfSpeech = v./(n.), Level = 4 }
161 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(14));
162 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = discourage(ment), PartOfSpeech = v./(n.), Level = 4 }
163 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(14));
164 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = disk/disc, PartOfSpeech = n., Level = 3 }
165 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(44));
166 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = doctor/doc, PartOfSpeech = n., Level = 1 }
167 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(20));
168 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = dormitory/dorm, PartOfSpeech = n., Level = 6 }
169 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
170 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = downward/downwards, PartOfSpeech = adv., Level = 6 }
171 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(66));
172 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = earring(s), PartOfSpeech = n., Level = 2 }
173 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(60));
174 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = embarrass(ment), PartOfSpeech = v./(n.), Level = 4 }
175 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(14));
176 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = employ(ment), PartOfSpeech = v./(n.), Level = 2 }
177 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(6));
178 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = encourage(ment), PartOfSpeech = v./(n.), Level = 2 }
179 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(5));
180 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = endorse(ment), PartOfSpeech = v./(n.), Level = 5 }
181 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(6));
182 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enforce(ment), PartOfSpeech = v./(n.), Level = 4 }
183 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = engage(ment), PartOfSpeech = v./(n.), Level = 3 }
184 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(3));
185 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enhance(ment), PartOfSpeech = v./(n.), Level = 6 }
186 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enjoy(ment), PartOfSpeech = v./(n.), Level = 1 }
187 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
188 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enlarge(ment), PartOfSpeech = v./(n.), Level = 4 }
189 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enlighten(ment), PartOfSpeech = v./(n.), Level = 6 }
190 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(2));
191 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enrich(ment), PartOfSpeech = v./(n.), Level = 6 }
192 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = enroll(ment), PartOfSpeech = v./(n.), Level = 6 }
193 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(3));
194 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = entertain(ment), PartOfSpeech = v./(n.), Level = 4 }
195 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(21));
196 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = equip(ment), PartOfSpeech = v./(n.), Level = 4 }
197 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(16));
198 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = establish(ment), PartOfSpeech = v./(n.), Level = 4 }
199 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(5));
200 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = ethic(s), PartOfSpeech = n., Level = 5 }
201 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
202 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = everyone/everybody, PartOfSpeech = pron., Level = 1 }
203 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
204 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = examination/exam, PartOfSpeech = n., Level = 2 }
205 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(15));
206 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = excite(ment), PartOfSpeech = v./(n.), Level = 2 }
207 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(64));
208 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = eyebrow/brow, PartOfSpeech = n., Level = 2 }
209 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = eyelash/lash, PartOfSpeech = n., Level = 6 }
210 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(85));
211 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = fiancé/fiance, PartOfSpeech = n., Level = 6 }
212 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(22));
213 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = fireman/firewoman, PartOfSpeech = n., Level = 2 }
214 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(91));
215 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = forward/forwards, PartOfSpeech = adv., Level = 2 }
216 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(50));
217 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = fulfill(ment), PartOfSpeech = v./(n.), Level = 4 }
218 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(35));
219 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = gasoline/gas, PartOfSpeech = n., Level = 3 }
220 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(57));
221 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = glove(s), PartOfSpeech = n., Level = 1 }
222 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(6));
223 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = god/goddess, PartOfSpeech = n., Level = 1 }
224 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(54));
225 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = greeting(s), PartOfSpeech = n., Level = 4 }
226 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(33));
227 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = gymnasium/gym, PartOfSpeech = n., Level = 2 }
228 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
229 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = hamburger/burger, PartOfSpeech = n., Level = 2 }
230 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(15));
231 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = harass(ment), PartOfSpeech = v./(n.), Level = 6 }
232 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(27));
233 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = he (him, his, himself), PartOfSpeech = pron., Level = 1 }
234 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(3));
235 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = headphone(s), PartOfSpeech = n., Level = 6 }
236 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(31));
237 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = hero/heroine, PartOfSpeech = n., Level = 2 }
238 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(16));
239 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = hippopotamus/hippo, PartOfSpeech = n., Level = 2 }
240 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(46));
241 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = host/hostess, PartOfSpeech = n., Level = 2 }
242 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(47));
243 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = I (me, my, mine, myself), PartOfSpeech = pron., Level = 1 }
244 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(53));
245 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = imprison(ment), PartOfSpeech = v./(n.), Level = 6 }
246 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = improve(ment), PartOfSpeech = v./(n.), Level = 2 }
247 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(129));
248 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = Internet/internet, PartOfSpeech = n., Level = 2 }
249 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(29));
250 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = invest(ment), PartOfSpeech = v./(n.), Level = 4 }
251 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(5));
252 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = involve(ment), PartOfSpeech = v./(n.), Level = 4 }
253 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
254 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = it (its, itself), PartOfSpeech = pron., Level = 1 }
255 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(37));
256 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = judgment/judgement, PartOfSpeech = n., Level = 2 }
257 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(53));
258 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = laboratory/lab, PartOfSpeech = n., Level = 4 }
259 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(214));
260 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = madam/ma’am, PartOfSpeech = n., Level = 6 }
261 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(26));
262 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = manage(ment), PartOfSpeech = v./(n.), Level = 2 }
263 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(5));
264 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = mankind/humankind, PartOfSpeech = n., Level = 3 }
265 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(38));
266 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = mathematics/math, PartOfSpeech = n., Level = 1 }
267 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(17));
268 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = measure(ment), PartOfSpeech = v./(n.), Level = 2 }
269 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = measure(s), PartOfSpeech = n., Level = 4 }
270 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(14));
271 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = medium/media, PartOfSpeech = n., Level = 3 }
272 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(35));
273 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = microphone/mike, PartOfSpeech = n., Level = 3 }
274 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(121));
275 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = move(ment), PartOfSpeech = v./(n.), Level = 1 }
276 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = movie/film, PartOfSpeech = n., Level = 1 }
277 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
278 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = Mr./Mister, PartOfSpeech = n., Level = 1 }
279 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1)); // WordData { Word = Mrs., PartOfSpeech = n., Level = 1 }
280 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1)); // WordData { Word = Ms., PartOfSpeech = n., Level = 1 }
281 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(91));
282 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = no/nope, PartOfSpeech = adj./adv./n., Level = 1 }
283 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(30));
284 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = nourish(ment), PartOfSpeech = v./(n.), Level = 6 }
285 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(19));
286 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = O.K./OK/okay, PartOfSpeech = adj./adv./n./v., Level = 1 }
287 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1)); // WordData { Word = o’clock, PartOfSpeech = adv., Level = 1 }
288 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(130));
289 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = outward/outwards, PartOfSpeech = adv., Level = 6 }
290 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(65));
291 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = parent(s), PartOfSpeech = n., Level = 1 }
292 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(40));
293 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = pave(ment), PartOfSpeech = v./(n.), Level = 3 }
294 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
295 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = pay(ment), PartOfSpeech = v./(n.), Level = 1 }
296 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(76));
297 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = photograph/photo, PartOfSpeech = n./v., Level = 1 }
298 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(75));
299 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = pm/p.m., PartOfSpeech = adv., Level = 1 }
300 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
301 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = policeman/cop, PartOfSpeech = n., Level = 2 }
302 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(41));
303 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = postpone(ment), PartOfSpeech = v./(n.), Level = 3 }
304 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(76));
305 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = prince/princess, PartOfSpeech = n., Level = 2 }
306 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(106));
307 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = punish(ment), PartOfSpeech = v./(n.), Level = 2 }
308 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(57));
309 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = railroad/railway, PartOfSpeech = n., Level = 2 }
310 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(81));
311 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = refine(ment), PartOfSpeech = v./(n.), Level = 6 }
312 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(4));
313 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = refresh(ment), PartOfSpeech = v./(n.), Level = 6 }
314 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = refreshment(s), PartOfSpeech = n., Level = 6 }
315 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = refrigerator/fridge, PartOfSpeech = n., Level = 2 }
316 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(67));
317 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = replace(ment), PartOfSpeech = v./(n.), Level = 3 }
318 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(12));
319 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = require(ment), PartOfSpeech = v./(n.), Level = 2 }
320 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(5));
321 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = resent(ment), PartOfSpeech = v./(n.), Level = 6 }
322 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(38));
323 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = retire(ment), PartOfSpeech = v./(n.), Level = 4 }
324 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(117));
325 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = salesperson/salesman/saleswoman, PartOfSpeech = n., Level = 2 }
326 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(21));
327 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = saving(s), PartOfSpeech = n., Level = 3 }
328 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(2));
329 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = scale(s), PartOfSpeech = n., Level = 3 }
330 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(47));
331 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = seagull/gull, PartOfSpeech = n., Level = 6 }
332 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(59));
333 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = settle(ment), PartOfSpeech = v./(n.), Level = 2 }
334 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(26));
335 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = she (her, hers, herself), PartOfSpeech = pron., Level = 1 }
336 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(17));
337 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = shoe(s), PartOfSpeech = n., Level = 1 }
338 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(103));
339 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = slipper(s), PartOfSpeech = n., Level = 2 }
340 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(24));
341 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = sneaker(s), PartOfSpeech = n., Level = 6 }
342 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(20));
343 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = sock(s), PartOfSpeech = n., Level = 2 }
344 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(21));
345 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = someone/somebody, PartOfSpeech = pron./n., Level = 1 }
346 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(29));
347 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = spacecraft/spaceship, PartOfSpeech = n., Level = 6 }
348 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(47));
349 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = spokesperson/spokesman/spokeswoman, PartOfSpeech = n., Level = 6 }
350 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(6));
351 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = sportsman/sportswoman, PartOfSpeech = n., Level = 6 }
352 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(41));
353 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = state(ment), PartOfSpeech = v./(n.), Level = 2 }
354 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(4));
355 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = statistic(s), PartOfSpeech = n., Level = 4 }
356 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(34));
357 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = stocking(s), PartOfSpeech = n., Level = 4 }
358 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(75));
359 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = subway/underground/metro, PartOfSpeech = n., Level = 2 }
360 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(110));
361 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1)); // WordData { Word = T-shirt, PartOfSpeech = n., Level = 1 }
362 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(3));
363 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = tactic(s), PartOfSpeech = n., Level = 5 }
364 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(21));
365 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = taxicab/taxi/cab, PartOfSpeech = n., Level = 1 }
366 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(18));
367 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = telephone/phone, PartOfSpeech = n./v., Level = 1 }
368 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(1));
369 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = television/TV, PartOfSpeech = n., Level = 1 }
370 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(55));
371 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = they (them, their, theirs, themselves), PartOfSpeech = pron., Level = 1 }
372 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(100));
373 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = toward/towards, PartOfSpeech = prep., Level = 2 }
374 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(43));
375 | wordInfoList.AddRange(inputReader.ReadWordInformation_Verb_Noun()); // WordData { Word = treat(ment), PartOfSpeech = v./(n.), Level = 1 }
376 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(111));
377 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = upward/upwards, PartOfSpeech = adv., Level = 6 }
378 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(59));
379 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = veterinarian/vet, PartOfSpeech = n., Level = 6 }
380 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(62));
381 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = wage(s), PartOfSpeech = n., Level = 3 }
382 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(3));
383 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = waiter/waitress, PartOfSpeech = n., Level = 2 }
384 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(29));
385 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = we (us, our, ours, ourselves), PartOfSpeech = pron., Level = 1 }
386 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(47));
387 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = whiskey/whisky, PartOfSpeech = n., Level = 6 }
388 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(15));
389 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = widow/widower, PartOfSpeech = n., Level = 6 }
390 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(22));
391 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_SinglePartOfSpeech()); // WordData { Word = witch/wizard, PartOfSpeech = n., Level = 4 }
392 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(13));
393 | wordInfoList.Add(inputReader.ReadWordInformation_PluralNoun()); // WordData { Word = wood(s), PartOfSpeech = n., Level = 2 }
394 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(38));
395 | wordInfoList.AddRange(inputReader.ReadWordInformation_MultiWords_MultiPartsOfSpeech()); // WordData { Word = yes/yeah, PartOfSpeech = adv./n., Level = 1 }
396 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(6));
397 | wordInfoList.AddRange(inputReader.ReadWordInformation_Pronoun()); // WordData { Word = you (your, yours, yourself, yourselves), PartOfSpeech = pron., Level = 1 }
398 | wordInfoList.AddRange(inputReader.ReadWordInformation_SingleWord_MultiPartsOfSpeech(10));
399 | }
400 |
401 | var outputFilePath = arguments[1];
402 | var sortedWordInfo =
403 | wordInfoList
404 | .GroupBy(wordInfo => wordInfo.Word)
405 | .Select(
406 | wordInfoGroup =>
407 | wordInfoGroup.Aggregate(
408 | (wordInfo1, wordInfo2) =>
409 | new(
410 | wordInfoGroup.Key,
411 | wordInfo1.PartsOfSpeech.Union(wordInfo2.PartsOfSpeech).ToArray(),
412 | wordInfo1.Level.CompareTo(wordInfo2.Level) <= 0 ? wordInfo1.Level : wordInfo2.Level)))
413 | .OrderBy(wordInfo => wordInfo.Word)
414 | .Select(
415 | wordInfo =>
416 | new WordInformation(
417 | wordInfo.Word,
418 | wordInfo.PartsOfSpeech.OrderBy(partOfSpeech => partOfSpeech).ToArray(),
419 | wordInfo.Level));
420 | var wordInfoJson = JsonSerializer.Serialize(sortedWordInfo);
421 | File.WriteAllText(outputFilePath, wordInfoJson);
422 | }
423 | }
424 | }
425 |
--------------------------------------------------------------------------------