# python-learn **Repository Path**: li_VillageHead/python-learn ## Basic Information - **Project Name**: python-learn - **Description**: 开启python学习之路 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-03-06 - **Last Updated**: 2025-08-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Python语言基础50课 https://github.com/jackfrued/Python-Core-50-Courses ## 环境变量 其中,.env文件中的内容为OpenAI中的API_KEY和API接口地址,如下。 注意,这里的OPENAI_API_KEY和OPENAI_BASE_URL名字不能修改,否则识别不了。 ```.env OPENAI_API_KEY="sk-xxxA" OPENAI_BASE_URL="https://api.openai.com/v1" ``` ```python import hanlp # 加载模型 # hanlp_model= hanlp.load("LARGE_ALBERT_BASE") hanlp_model = hanlp.load(hanlp.pretrained.ner.MSRA_NER_ALBERT_BASE_ZH) text ="我喜欢北京天安门广场" # worlds=hanlp_model(text) # # print("分词结果:",worlds) ner_results=hanlp_model(text) print("命名实体识别结果:",ner_results) ``` ## 运行结果 ```python E:\CacheData\anaconda\envs\hanlp-python38\python.exe D:\OpenSource\Tags\python-learn\Day02-Hanlp\hanlp_example.py 命名实体识别结果: [('北京', 'NS', 3, 5), ('天安门广场', 'NS', 5, 10)] Process finished with exit code 0 ``` ## 数据集 https://github.com/mwaskom/seaborn-data/blob/master/ ## 命名实体官方网站 https://hanlp.hankcs.com/demos/ner.html https://matplotlib.org/stable/plot_types/stats/violin.html#sphx-glr-plot-types-stats-violin-py https://matplotlib.org/stable/users/explain/customizing.html ## 中文 https://www.matplotlib.net/stable/index.html https://smith.langchain.com/