Word2Vec word vector analysis (word similarity) based on the character story of Genshin Impact character Keqing

First get the character text of Keqing:

raw_texts = [
    "Emperor Yanwang brought prosperity to Liyue Port, and his reputation for governing the world was turned into novels and biographies that people talked about. However, as one of the people closest to God, Keqing seems to be the one who lacks the least awe. \
"Hmph, to put it bluntly, does Morax really know everything?" Liyue Qixing always pays attention to the big and small things in the port, but the Rock King only comes once a year. \
Thousands of years of history have proven that following the emperor's footsteps is the right thing to do, but Keqing always believes that being born as a "human" should have the pride of being a "human", and the ideas of "human" should also be taken seriously. \
Therefore, she often expressed opinions that were different from those of the emperor and took the lead in putting them into practice. Such a radical approach has indeed achieved many outstanding results, but it has also attracted opposition from many devout followers of the Rock King. \
In Keqing's view, this kind of opposition is nothing more than an excuse for laziness - she is used to living under the protection of gods and will never take the initiative to think about the future of mankind. \
But there is always one person who wants to be at the forefront of the times and blaze a new path with his own hands. Yuhengxing naturally did his part. \
Keqing was born into a distinguished family. She has a deeper understanding than most of the impact that Emperor Yan Wang had on the people of Liyue. \
Just like a cycle of reincarnation, every few years, after the Immortal Invitation Ceremony, great turmoil will occur in Liyue's business world. The emperor's newly announced decision always makes some families happy and others sad. \
The poor hope to take this opportunity to make a fortune, while the rich pray that the change in wind direction will not affect their property. \
Businessmen are more keen on faith-based investments than considering economic construction. \
In today's Liyue, this choice is understandable. The emperor's divine power is powerful, and you can rely on him to live and feed well. \
Keqing has always had concerns about this: if one day the emperor no longer fulfills this responsibility, where will Liyue go? \
The current prosperity of Liyue Port is like a magnificent sandcastle on the beach. It is not humans themselves who decide whether the sea has a high tide. \
However, Keqing could not get the support of the majority. In the eyes of others, a mortal's life is only a moment in the history of Liyue, so there is no need to worry about it. \
Keqing believes that this lazy and cowardly idea denies the existence value of the entire human race. But if human existence is meaningless, why are they loved by God? \
With the feeling of hating that iron cannot be transformed into steel, she bravely chose to question-questioning the doting of the emperor, questioning the laziness of the people, and questioning the way society operates. \
Things related to human destiny should be done by humans. And humans can certainly do better. \
Finally, she made her famous speech at the ceremony of inviting immortals. \
"The emperor has protected Liyue for a thousand years, but will it be the same in the next thousand years, ten thousand years, or one hundred thousand years?" \
Hearing these words, the emperor laughed meaningfully. As for its meaning, I am afraid only the emperor himself knows. \
Maybe someone can keep up with Keqing's thoughts, but no one can keep up with her pace. \
Perhaps because she hopes to be a role model for the people, she always requires herself to work twice as hard as ordinary people. At the same time, she also despises all "laziness" and "inefficiency". \
The power and lifespan of human beings are not as good as those of gods. If they are still hindered by inertia and hesitation, the day when they can replace gods and take charge will never come. \
It is precisely because of this idea that her actions are always inconsistent with those around her. \
She won't rest until she's done. Even if it is a matter that takes half a month to solve, she will try her best to shorten the cycle and complete it in a day or two. \
The completion that Keqing mentioned is not limited to finishing, but completing all the details related to this matter. In the eyes of others, she is always efficient and perfect. \
However, not everyone has as much subjective initiative as Keqing. No one who assisted Keqing in his work could last more than three months. \
Keqing had received countless suggestions to advise her not to be so impatient, but she had coldly rejected them every time. \
However, Keqing also realized to some extent that frequent personnel changes were in itself a manifestation of inefficiency. She still made some concessions. \
Now, don't be surprised if you see Keqing's assistants planning for three to five years from now - Keqing just lets them go ahead, and she will arrive later. \
"Yesterday's experience will become tomorrow's strength." This is one of Keqing's life creeds. \
Just staying at Yujingtai, you can only see the same scenery. If you want to have thunderous judgment and execution, you need a lot of experience. \
As long as it is something Keqing thinks is valuable, she will definitely take care of it herself. For example, in order to formulate a plan to improve workers' treatment, she went to the site in person and experienced worker life for two full months. \
It is hard to imagine that this high-ranking girl pulled a car in the abyss of rock formations, helped the workers at the South Pier pound soil, and walked through the streets in a small restaurant. \
After work, she also collected evidence and reported a sinister bully who was exploiting workers. \
When the bully is arrested, he has no idea why he was caught. \
He was escorted to the interrogation hall by Qianyan Army, where he saw a heroic girl dressed in gorgeous clothes. \
"I...have we met somewhere?" \
As soon as the words came out of his mouth, he felt baffled. \
Because, Qian Yanjun on the side introduced the girl like this: "That person is the Yuheng star of the Seven Stars of Liyue, so she is so close!" \
--Yes, how is that possible? \
The departure of Emperor Yanwang has plunged Liyue Port into a very difficult period. All affairs that were originally under the full supervision of the emperor were assigned to the hands of the Seven Stars and Eight Gates. \
Theocratic rule has become an afterimage of the past, and naturally the remaining old rules cannot be copied in their entirety. But it is immeasurably difficult to re-write the rules for Liyue, which has a history of thousands of years. \
At first, Keqing was extremely excited. She was already prepared and looking forward to the day when she would show off her talents. But she didn't expect that a few months later, she was still stuck in a single job, busy with land and infrastructure construction. \
No matter how hard she struggled, the accumulated affairs still clung to her like a quagmire. Even if he achieves something, it is only something that the former emperors could easily do. \
"Why can it only be done to this extent? Why...can't it be better?"\
Of course she understands the reason... In fact, she has already realized the truth. \
Even if one's "disrespect" can even be recognized by the gods... that doesn't mean that the current self has the ability to "replace" it. \
However, she is determined and tenacious Ke Qing after all. From that day on, she stayed behind closed doors, immersed herself in various classics, and learned all the necessary knowledge again. She lowered herself to the lowest level and faced all the unknown with full acceptance. \
During this period, she calmed down her mind and gradually abandoned her long-standing sense of "confrontation" with the Rock King. Both Dijun and Keqing are just running for this thousand-year Liyue - there is absolutely no reason for two people who love the same thing. \
There seems to be an explanation for the emperor's mysterious smile in the past ceremony of inviting immortals. Ke Qing thought, that might be a smile of recognition and expectation. \
Nowadays, she has not lost her resolute style, but when she is confused, she will stop and think: "What would I do if I were an emperor?" \
Keqing, who devotes most of her energy to Liyue Port, actually adopts a pastime in her spare time that others cannot predict - consumption. \
On her days off, she would put on simple clothes, meet up with a few friends, stroll around Feiyun Slope and Chihu Rock, and enjoy shopping. \
After the emperor left, Keqing, who became busier and busier, still retained this method of relieving stress. However, there was a slight change. \
While shopping, she happened to catch a glimpse of a two-headed earthen doll of the Rock King on an inconspicuous stall on the roadside. \
Keqing made a quick decision and found an excuse to send her friends to the silk shop across the street. She came to the stall herself and took the emperor's clay puppet in her hand to look at it carefully. \
She knew she must not waste too much time on this matter, so she carefully observed her surroundings. After making sure it is unobtrusive, purchase, pay and pick up the goods in one go. \
After putting the puppet into her bag, Ke Qing breathed a sigh of relief and smiled warmly. At this moment, a friend holding silk patted her. \
Things eventually came to light. Everyone was very surprised. Keqing was clearly the most ungodly person, so why would he buy the emperor's clay doll?\
"I, I bought this just for self-examination! There's nothing wrong with it!"\
The term "introspection" can be explained tentatively. But in fact, Keqing had unknowingly bought a whole cabinet of these small items for "introspection". \
Keqing, who was born as a noble lady, currently maintains the minimum luxury required by her status to match her status as the Seven Stars of Liyue. \
Outside of the prosperous city, she often goes deep into uninhabited places to gain knowledge and sharpen her will. \
She has experienced countless dangers, but unlike adventurers and backpackers, she did not have bags or bags on her journey, only her hairpin and sword. \
As long as the power of thunder element is attached, the hairpin can be turned into an extremely sharp knife. Not to mention cutting grass and wood, menial tasks such as skinning and deboning prey are also a piece of cake. \
If you encounter terrain with a large height difference, you only need to nail a hairpin into the ground and tie a rattan to make it easy to descend quickly. \
When sleeping in the wild, placing the hairpin upright on the ground before going to bed will serve as an extremely sensitive alarm device. As long as there is any abnormal disturbance around you, it will wake up Qingqing immediately. \
When he gets hungry, all he has to do is throw the hairpin into the water, and a few unlucky fish will be stunned - he doesn't even need to prepare bamboo skewers for grilling the fish. \
If an unsophisticated person teases Keqing that her hairpin is a bit old and in poor condition, she will not only not be angry, but will also act extremely proud. \
"The way it looks stained by wind and frost is the most attractive."\
Keqing is probably unique in not respecting the "Eye of God". \
Ke Qing knew very well that all her achievements were clearly achieved through her own efforts, and in the eyes of others, they were attributed to the "eyes of God". \
She had to think that this purple crystal took away her pride and was a provocation and insult given to her by God. \
In order to destroy the "Eye of God", she tried countless methods: burning it with fire for three days and three nights, running it over with a mine cart filled with stones, or throwing it directly from the Jade Pavilion. \
Unfortunately, all of the above ended in failure. \
Keqing had nothing to do, but she didn't want it to fall into the hands of thieves, so she finally reluctantly accepted the "Eye of God" that belonged to her. \
As time goes by, Keqing gradually recognizes the "Eye of God". \
She realized that this item was not hosted by the consciousness of God, but also provided practical help in many things, so she decided to make use of this power. \
"What is more important than the source of power is the driver of power." \
No matter how you viewed the "Eye of God" in the past, this power is now an indispensable part of Keqing. \
Fortunately, it was not destroyed back then, otherwise, she would definitely regret it - who makes her a pragmatist? "
]

Then run the code:

from gensim.models import Word2Vec
import jieba

raw_texts = [
...(see above)
]

# Add multiple custom words (it has not been tested whether all wrongly classified words have been added)
custom_words = ["Emperor", "Liyue", "Keqing", "Eye of God"]
for word in custom_words:
    jieba.add_word(word)

texts = [[word for word in jieba.cut(text, cut_all=True)] for text in raw_texts] # Word segmentation
models = Word2Vec(texts, min_count=1, window=3, vector_size=5)

print(models.wv['Keqing']) # Access word vector
print(models.wv.similarity("Keqing", "Lei")) # Similarity
print(models.wv.similar_by_word("Keqing", topn=10)) # The most similar word

Get:

[-0.06413972 -0.01304893 0.14363092 -0.17444395 -0.08732218]
0.464457
[(‘Fact’, 0.96968674659729), (‘Wild’, 0.9624642133712769), (‘Out’, 0.9456754326820374), (‘Mysterious’, 0.9414153099060059), (‘Required’, 0.937 5007748603821 ), (‘Compression’, 0.9356200098991394), (‘Attachment’, 0.9353497624397278), (‘Copy’, 0.9271456599235535), (‘Yuan’, 0.922188937664032), (‘Tanqian’, 0.9215773344039917)]
The first of which is the word vector,

The second one (0.464457) is the similarity between “Keqing” and “Lei”

The third one is the ten words most similar to “Keqing”.

Room for improvement:

Check word segmentation accuracy, increase corpus size, adjust model parameters, and delete stop words.