{"id":50350535,"url":"https://github.com/NLPchina/ansj_fast_lda","last_synced_at":"2026-06-15T12:01:48.165Z","repository":{"id":145025088,"uuid":"9383880","full_name":"NLPchina/ansj_fast_lda","owner":"NLPchina","description":"LDA 的java实现","archived":false,"fork":false,"pushed_at":"2016-01-20T13:28:53.000Z","size":76037,"stargazers_count":64,"open_issues_count":4,"forks_count":70,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-01-14T00:20:54.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NLPchina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-12T01:22:13.000Z","updated_at":"2025-08-22T01:29:16.000Z","dependencies_parsed_at":"2023-04-18T12:47:54.728Z","dependency_job_id":null,"html_url":"https://github.com/NLPchina/ansj_fast_lda","commit_stats":null,"previous_names":["ansjsun/ansj_fast_lda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NLPchina/ansj_fast_lda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLPchina%2Fansj_fast_lda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLPchina%2Fansj_fast_lda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLPchina%2Fansj_fast_lda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLPchina%2Fansj_fast_lda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NLPchina","download_url":"https://codeload.github.com/NLPchina/ansj_fast_lda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLPchina%2Fansj_fast_lda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34361403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-29T21:00:23.928Z","updated_at":"2026-06-15T12:01:48.159Z","avatar_url":"https://github.com/NLPchina.png","language":"Java","funding_links":[],"categories":["人工智能"],"sub_categories":["机器学习"],"readme":"ansj_fast_lda\n=============\n\n这是我在参考了 yangliuy 童靴的lda实现..做的..\n\n是一个利用GibbsSampling 的LDA实现\n\n封装了两个内置的分词\n\n\n调用方式更加简单.ps目前不支持命令行.代码里面有两个例子大家可以参考\n\n````\n\t\tFile[] files = new File(\"/Users/ansj/Desktop/搜索组分享/文本分类语料库\").listFiles();\n\n\t\tLDA lda = new LDA(10);\n\t\tfor (File file : files) {\n\t\t\tlda.addDoc(file, \"gb2312\");\n\t\t}\n\n\t\tlda.trainAndSave(\"result/cluster\", \"utf-8\");\n````\n\n\n或者\n\n\n````\n\t\tAnalysis dicAnalysis = DicAnalysis.getInstance(new File(\"library/result_1_3.dic\"), \"UTF-8\");\n\t\tLDA lda = new LDA(dicAnalysis, new LDAGibbsModel(10, 5, 0.1, 100, Integer.MAX_VALUE, Integer.MAX_VALUE));\n\t\tBufferedReader newReader = Files.newReader(new File(\"/Users/ansj/Documents/temp/computer_300000.txt\"), Charsets.UTF_8);\n\t\t\n\t\tString temp = null;\n\t\twhile ((temp = newReader.readLine()) != null) {\n\t\t\tlda.addDoc(temp);\n\t\t}\n\n\t\tlda.trainAndSave(\"result/computer\", \"utf-8\");\n````\n\n\n以下是运行后的一个结果 10个topic 100次迭代\n\n````\ntopic 0\t:\n\t教育 0.024076469669325036\n\t学校 0.016010479660942534\n\t学生 0.014581063710089938\n\t工作 0.010251975401793508\n\t教师 0.010160084376381556\n\t发展 0.009863991072276375\n\t社会 0.007607555892716207\n\t教学 0.006249610739406241\n\t建设 0.005902466865627754\n\t提高 0.0053613308270907\n\t学习 0.004871245358226952\n\t孩子 0.0041769576106699775\n\t培养 0.004136117154931332\n\t实施 0.003727712597544876\n\t进行 0.003697082255740892\n\t管理 0.0036358215721329235\n\t思想 0.003349938381962404\n\t国家 0.003268257470485113\n\t改革 0.003237627128681129\n\t活动 0.003186576559007822\n\ntopic 1\t:\n\t环境 0.016325714890308193\n\t光华 0.01205996899776804\n\t日月 0.011455375091738728\n\t污染 0.005594173058287891\n\t城市 0.005510201682450487\n\t环保 0.004536133722736594\n\t垃圾 0.004485750897234152\n\t文章 0.004401779521396747\n\t信区 0.004267425320056899\n\t来源 0.004149865393884533\n\t发信人 0.004133071118717052\n\t阅读 0.004133071118717052\n\tfudan 0.00409948256838209\n\tedu 0.004082688293214609\n\t环境保护 0.003998716917377205\n\t发信站 0.0039147455415398\n\tcn 0.003897951266372319\n\t返回 0.003864362716037357\n\t讨论区 0.003847568440869876\n\t药物 0.0037971856153674335\n\ntopic 2\t:\n\t网络 0.009624681710355278\n\t规定 0.008204120848487257\n\t病毒 0.007501477841541783\n\t管理 0.006096191827650836\n\t安全 0.00591289365192593\n\t软件 0.005576846996430269\n\t计算机 0.005240800340934607\n\t使用 0.0051033267091409274\n\t文件 0.004874203989484795\n\t光华 0.004843654293530644\n\t日月 0.0045839818779203605\n\t用户 0.004538157333989134\n\t进行 0.004477057942080832\n\twindows 0.004171560982539322\n\t单位 0.0041410112865851705\n\t应当 0.004125736438608095\n\t微软 0.0040799118946768685\n\t信息 0.0040188125027685664\n\t程序 0.003896613718951962\n\t机动车 0.00383551432704366\n\ntopic 3\t:\n\t新华社 0.0126322893839167\n\t中国 0.012225714250864987\n\t主席 0.010409678656567339\n\t问题 0.00985402597473\n\t国家 0.008756273115490376\n\t总统 0.008580090557834635\n\t今天 0.007685625265120868\n\t访问 0.00730615514093927\n\t人民 0.007238392618763984\n\t举行 0.0071435250877185845\n\t会议 0.006533662388141017\n\t表示 0.0065065573792709025\n\t苏联 0.006289717308309989\n\t合作 0.006127087255089304\n\t两国 0.006032219724043905\n\t记者 0.005978009706303676\n\t关系 0.005842484661953105\n\t发展 0.005747617130907706\n\t美国 0.00563919709542725\n\t会见 0.0049480193692393384\n\ntopic 4\t:\n\t经济 0.02759296744343016\n\t中国 0.01584534610437293\n\t发展 0.012999604599233078\n\t增长 0.009474603187087483\n\t国家 0.006292806780586894\n\t社会 0.005842350210677823\n\t政府 0.0057994495849721965\n\t问题 0.005742248750698029\n\t美国 0.005420494057905834\n\t市场 0.005348993015063125\n\t世界 0.005205990929377705\n\t企业 0.005055838739408014\n\t投资 0.004548181335224774\n\t我国 0.004326528102412373\n\t技术 0.004061974243894347\n\t可能 0.003690168821112256\n\t增加 0.003618667778269546\n\t认为 0.003611517673985275\n\t这种 0.003604367569701004\n\t改革 0.0035328665268582944\n\ntopic 5\t:\n\t比赛 0.023177485843473445\n\t选手 0.011980032687335522\n\t参加 0.011323446686103978\n\t中国 0.011270209983301421\n\t北京 0.011110499874893749\n\t亚运会 0.010879807496082666\n\t今天 0.010294203765254533\n\t冠军 0.00855513814037099\n\t世界 0.008484155869967579\n\t新华社 0.008430919167165022\n\t记者 0.00827120905875735\n\t成绩 0.007880806571538595\n\t获得 0.007721096463130922\n\t中国队 0.0076678597603283645\n\t举行 0.006691853542281477\n\t女子 0.006443415595869542\n\t金牌 0.006372433325466133\n\t进行 0.005698101756633737\n\t队员 0.005591628351028622\n\t全国 0.005325444837015835\n\ntopic 6\t:\n\t电脑 0.00674109146361348\n\t产品 0.006725562572888731\n\t设备 0.006150993616073024\n\t内存 0.0059335891459265395\n\t技术 0.005840415801578046\n\t选择 0.005048442374615854\n\t显示器 0.0049397401395426125\n\t公司 0.004862095685918868\n\tcpu 0.004768922341570375\n\t价格 0.004737864560120877\n\t没有 0.004598104543598137\n\tusb 0.004551517871423891\n\t支持 0.004520460089974393\n\t主板 0.004442815636350649\n\t采用 0.0044272867456259\n\t性能 0.004411757854901151\n\t使用 0.004396228964176402\n\t速度 0.004240940056928914\n\t系统 0.004147766712580421\n\t需要 0.00402353558678243\n\ntopic 7\t:\n\t文化 0.020326661598747707\n\t艺术 0.016473812740009988\n\t演出 0.009171856669408264\n\t活动 0.008595082888160103\n\t创作 0.008283625046286096\n\t群众 0.008249018619411207\n\t作品 0.006599445605041464\n\t文艺 0.006068813726293155\n\t举办 0.005722749457544259\n\t全国 0.005422827091295214\n\t中国 0.005180582103170987\n\t民族 0.0048575887856720165\n\t工作 0.004649950224422678\n\t音乐 0.004176995723799186\n\t参加 0.003738647650050583\n\t人民 0.0037155766988006566\n\t优秀 0.0037040412231756936\n\t电影 0.003634828369425914\n\t生活 0.0034271898081765758\n\t建设 0.003288764100677017\n\ntopic 8\t:\n\t使用 0.007529768353427813\n\t进行 0.007150280759611747\n\t系统 0.007003382336199076\n\t美国 0.005252842790531417\n\t问题 0.004787664449724627\n\t目标 0.004408176855908561\n\t美军 0.004285761503064668\n\t函数 0.0042735199677802795\n\t没有 0.004187829220789555\n\t设计 0.003906273909248603\n\t飞机 0.003881790838679824\n\t导弹 0.0038573077681110456\n\t能力 0.0037838585564047103\n\t战争 0.0037471339505515426\n\t武器 0.003722650879982764\n\t过程 0.003722650879982764\n\t可能 0.0036369601329920395\n\t作战 0.0035390278507169254\n\t方法 0.003343163286166698\n\t装备 0.0033064386803135304\n\ntopic 9\t:\n\t企业 0.013354841192682198\n\t上海 0.009405784030079769\n\t记者 0.0077157214308304235\n\t新华社 0.006996189829169812\n\t生产 0.006477457744251696\n\t合作 0.005490193453601089\n\t全国 0.005255927350734843\n\t时间 0.00517226088542547\n\t地区 0.004988194661744848\n\t公司 0.004988194661744848\n\t投资 0.0048375950241879755\n\t铁路 0.004753928558878602\n\t北京 0.004469462576826733\n\t产品 0.004419262697641108\n\t资金 0.004302129646207986\n\t运输 0.004268663060084235\n\t单位 0.004184996594774862\n\t去年 0.0041515300086511124\n\t今年 0.00403439695721799\n\t职工 0.003900530612722992\n\n````\n\n\n\n测试效果60w我文章大约需要3g内存\n\n\n\n\n\n再次感谢yangliuy童鞋!!!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNLPchina%2Fansj_fast_lda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNLPchina%2Fansj_fast_lda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNLPchina%2Fansj_fast_lda/lists"}