My baby will be born soon! Now, in addition to preparing all the baby stuff, we also have the task of naming.
Naming this thing is very difficult, to listen to, unconventional, but also pay attention to feng Shui, it is best to have a poem of chu ci source.
Dad, a programmer, decided to write his own program to generate the baby’s name, which could be based on feng shui and poetry to narrow down the selection but still have enough names for us to choose from.
In the future, when people ask me how my baby’s name came from, the baby can say, “My father used code to calculate my name!”
The name of feng shui
I’m not a superstitious person, and I think everything about feng shui is about happiness. According to feng shui naming is mainly to narrow the range of choice, and then figure a peace of mind, I hope the baby healthy and happy growth.
Since want to do, holding programmer rigorous attitude, be about to undertake some research to geomantic name.
A birth horoscope
According to the time when the baby was born, convert into the corresponding five elements, see is missing which kind, with the name to fill.
For example, if the five elements lack “gold”, the words with gold characters are used to fill the name.
More specifically, I didn’t go into the details, because the birth date is the premise of knowing when the baby was born. If you want to choose a good name before the baby is born, we can learn about the “five-compartment dissection”.
Five case profile method
The five-case profile method, also known as three-only five-case, is a popular naming method and the basis of many naming and scoring applications. It divides the number of strokes of the name into heavenly case, earthly case, personality case, outer case and total case.
The meanings of the five squares are as follows:
Tianga is the root – Tianga is left by our ancestors and is the fortune of our parents.
Personality is miao – also known as “Zhu Yun”, is the center of the whole name, the fate of a person’s life is mainly inferred from this case.
Ground frame is flower – also known as “qian Yun”, the main age before 38 years old, in charge of the activity before middle age.
Outer case is leaf – the spiritual force in charge of destiny, generally referred to as noble or external help. For a person outside harmony, can be seen from this case.
Total case is fruit – the fate of the master from middle age to old age, also known as the later luck, the master after 38 years old.
They are calculated like this:
Tiangai: Stroke count of last name + 1
Personality: number of strokes of last name + number of strokes of first name
Ground case: Add the number of strokes of the name
Total case: The total number of strokes of a name
Outer case: Total case – Personality + 1
The number of strokes here is calculated according to the strokes in kangxi dictionary, that is, according to traditional Chinese characters. There are also radicals that affect stroke count:
What language is thine? What language is thine? What language is thine? Such as: clean, clean and so on; The two sides were described as four pictures. Such as pick, dial, etc; (3) “month” is six pictures beside the meat. Such as clothing, pulse, etc.; (4) Fuck is six pictures. Such as English, apple, rong and so on; (5) “add seven pictures”. Such as reach, mai, xun, guo, etc.; (6) The left “Di” is counted as eight paintings, Yang, Yin, Chen and Lu etc.; (7) The right “backward” painting, such as Namely, Deng, Kuang, etc.; “Wang” is reckoned to be the five wan Wan, Wan Wan, Rose, rose, etc. (9) 礻 (show), to show that the word plan is five pictures; (10) 衤 (yi), with yi plan for six pictures; (11) Dogs count as four pictures. Such as di, Meng, du, etc.; (12) 忄 (heart), beside the heart, with heart word plan as four pictures; (13) The characters “one, two, three, four, five, six, seven, eight, nine, ten” in the name should be drawn in 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 respectively.
Finally, the calculated number of five strokes was divided into three groups: lucky, half lucky and fierce:
Auspicious numbers: 1, 3, 5, 8, 11, 13, 15, 16, 21, 23, 24, 25, 29, 31, 32, 33, 35, 37, 38, 39, 41, 45, 47, 48, 52, 57, 63, 65, 67, 68, 81
The numbers that are half lucky: 6, 7, 17, 18, 27, 30, 40, 51, 52, 55, 61, 75
The numbers of the fierce: 2, 4, 9, 10, 12, 14, 19, 20, 22, 26, 28, 34, 36, 42, 43, 44, 46, 49, 50, 53, 54, 56, 58, 59, 60, 62, 64, 66, 69, 70, 71, 72, 73, 74, 76, 77, 78, 79, 80
Dad gave me thick thick two books, in fact, summed up is the above content.
With that, you can start writing code, and the first step of the program is to calculate five strokes of the first name, based on the last name. But the combination will be more, so I used the “three configuration” for a filter.
Only three configuration
The five elements
wood
The fire
soil
gold
water
digital
1, 2,
3, 4
5, 6
Seven, eight
9 · 0
The day lattice, ground lattice, personality units in accordance with the above rules into five elements, get is three only configuration.
The five elements complement each other as follows:
Wood fire fire soil gold water water wood
Muke earth, water, water, fire, fire, gold, wood
I in the program is according to the three configuration auspicious table for filtering. After three to five lattice calculation, we get the suitable number of strokes of the name combination. The next step is to generate the name.
Female Book of Songs, Male ci of Chu, Analects of Wen, Wu and Zhouyi
Since ancient times, there has been a saying “The Book of Songs for women, ci of Chu for men, Analects of Wen, Wu and Zhou Yi”. I also hope to give the baby a nice and poetic name.
I found the library of these works on Github and extracted the corresponding words from the poem according to the combination of strokes.
However, I feel that the data amount of these works is not enough, I also added a large amount of Tang poetry and Song ci, but also because of the large amount of data of Tang poetry and Song ci, it will take a long time to generate the name.
Finally, filter out some obviously inappropriate names from the name library and you’re done.
View the name configuration and source
After writing naming procedures, I did according to the name, view three to five lattice configuration and name source function.
So in addition to using it for naming, you can also use it to see where your name is mentioned in a book of poetry, in a three-panel configuration.
The program is open source. Here’s how it works.
Method of use
Project address: the project address is clicked
1. Install the third-party library
Install OpenCC:
PIP install Opencc copies the codeCopy the code
2. Set parameters
Open config.py and set the parameters:
Choosing a thesaurus # 0 # : "default", rank 1: "book of songs", 2: "chu ci", 3: "the analects", # 4: "zhouyi", 5: "tang poetry", 6: "song poetry", 7: Name_source = 0 (last_name = "last_name") Dislike_words = list("") # min_stroke_count = 3 # max_stroke_count = 25 # Name_validate = True # allow_general = False # allow_general = False Only when open name screening effective gender = "" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # fill in the name, look at three to five configuration, support only shan after # if you want to name, Please leave this value empty check_name = "" # whether to display name source check_name_resource = True copy codeCopy the code
3. Run the query result
After running main.py, the results will be generated in a name.text file, such as:
Zhang Zhewei male Zhe Wei 10 14 "zhe" people's foolishness, also "wei" si surly. Without competing "wei" people, the quartet of its training. Enlightened virtue, four countries shun it. Zhang Ning male jia ning 10 14 have ð«£ State "home" light. There are pepper xin, Hu Kao's "ning". Bandits and have and, bandits today, today, zhengu Ruzi. Zhang Huaiyuan male huaiyuan 20 4 pian the flying owl, set in panlin. Eat my mulberry 黮, "bosom" my good sound. He will come to offer his treasure. "Yuan" turtle elephant teeth, big south Gold. Zhang Hengshou male Hengshou 10 14 like the "constancy" of the moon, like the rising of the sun. Such as the "longevity" of nanshan, no qian, no collapse. Such as pine and cypress, all or bear. Copy the codeCopy the code
You can paste the results into an Excel spreadsheet and filter them by word or stroke.
If you are looking at the name configuration and source, the results will be printed directly, for example:
Chou Jielun Chou Jielun 8 8 10 days ge 9 personality 16 Good luck ge 18 good luck general ge 26 fierce outside ge 11 Good luck three talents soil water jin Zhongji Tang poetry from Shu was ordered to the Way to the Shuofang presented to Wei Left minister of the ministry of Literature under the door Of Cui Lang Jia Zhi who called three "jie" talent, achievement alone "lun". Song poem answer Zhao Wenfu see Xie Tea ou yun Peng Ru li 朅 to dongjiang to learn ancient, like to listen to English "Jie" ginseng I "lun". Copy the codeCopy the code
Thank you
Thanks to the following excellent open source libraries, I can easily get and process names:
- OpenCC
- chinese-poetry
- chineseStroke
- Chinese-Names-Corpus
- hanzi_chaizi
The last
Finally, the purpose of this project is to help us name our babies. If you look at the name configuration and find it is not very good, it does not matter, is a happy picture.
Currently, only single-name and multiple-name names are supported, that is, a one-character surname and a two-character name. If you take into account double or single names, the algorithm is a little bit different. But mostly individuals don’t have the need, so they don’t do it. If you want to do that you’ll consider adding it later. In the future, we will consider adding the figure of eight.
Did you learn?