📄 dex.java
字号:
/* Copyright (C) 2003 Univ. of Massachusetts Amherst, Computer Science Dept. This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit). http://www.cs.umass.edu/~mccallum/mallet This software is provided under the terms of the Common Public License, version 1.0, as published by http://www.opensource.org. For further information, see the file `LICENSE' included with this distribution. *//** Driver file for DEX: automatically extracting social networks and * contact information from email and the web. * @author Aron Culotta <A HREF="mailto:culotta@cs.umass.edu">culotta@cs.umass.edu</A>*/package edu.umass.cs.mallet.projects.dex;import edu.umass.cs.mallet.projects.dex.types.*;import edu.umass.cs.mallet.projects.dex.graph.*;import edu.umass.cs.mallet.base.util.*;import java.io.*;import java.util.logging.*;public class DEX { private static Logger logger = MalletLogger.getLogger(DEX.class.getName()); public static void main (String[] args) { commandOptions.process (args); commandOptions.logOptions (logger); makeDir(outputDirOption.value); PeopleManager pm = new PeopleManager (inputDirOption.value, outputDirOption.value, stopListOption.value, userNameOption.value, readPeopleOption.value, vcfOutputOption.value, htmlOutputOption.value); pm.writeTXT (new File ("people.txt")); pm.expandSocialNetwork (numberHopsOption.value, crfFileOption.value); if (writePeopleOption.value != null) pm.writePeople (writePeopleOption.value); pm.writeTXT (new File ("people.txt")); pm.writeHTML (htmlOutputOption.value); pm.writeVCF (vcfOutputOption.value); PeopleGraph pg = new PeopleGraph (pm.getPeople()); pg.printAllStatistics (); } public static void makeDir(File dir) { try { if(dir.exists() == false) dir.mkdir(); } catch (SecurityException e) { System.out.println("No permission to make directory " + dir); } } /** options */ static CommandOption.File inputDirOption = new CommandOption.File (DEX.class, "input-dir", "FILE", true, null, "input directory containing emails", null); static CommandOption.File outputDirOption = new CommandOption.File (DEX.class, "output-dir", "FILE", true, null, "output directory to place discovered web pages", null); static CommandOption.File csvOutputOption = new CommandOption.File (DEX.class, "csv-output", "FILE", true, new File ("output.csv"), "csv output file", null); static CommandOption.File htmlOutputOption = new CommandOption.File (DEX.class, "html-output", "FILE", true, new File ("output.html"), "html output file", null); static CommandOption.File vcfOutputOption = new CommandOption.File (DEX.class, "vcf-output", "FILE", true, new File ("output.vcf"), "VCF (vCard format) output file", null); static CommandOption.File stopListOption = new CommandOption.File (DEX.class, "stop-list", "FILE", true, new File ("/usr/col/tmp1/ronb/mallet/exp/calo/stop"), "stop list file for keywords", null); static CommandOption.File readPeopleOption = new CommandOption.File (DEX.class, "read-people", "FILE", true, null, "file to read People", null); static CommandOption.File writePeopleOption = new CommandOption.File (DEX.class, "write-people", "FILE", true, null, "file to write People", null); static CommandOption.String userNameOption = new CommandOption.String (DEX.class, "user-name", "FILE", true, null, "name of user", null); static CommandOption.File crfFileOption = new CommandOption.File (DEX.class, "crf-file", "FILE", true, new File ("/usr/col/tmp1/culotta/mallet/exp/address/crf.obj"), "CRF object file to perform contact record extraction", null); static CommandOption.Boolean confidencePredictionOption = new CommandOption.Boolean (DEX.class, "confidence-prediction", "true|false", false, false, "predict confidence of each extracted field?", null); static CommandOption.Boolean searchWebOption = new CommandOption.Boolean (DEX.class, "search-web", "true|false", true, true, "True if we should query google. If false, assumes <outputDir> contains files for each person.", null); static CommandOption.Integer numberHopsOption = new CommandOption.Integer (DEX.class, "number-hops", "INTEGER", true, 2, "The number of outlink hops to explore from the initial set of people.", null); static final CommandOption.List commandOptions = new CommandOption.List ( "DEX: Automated Rolodex Construction from Email.", new CommandOption[] { inputDirOption, outputDirOption, userNameOption, confidencePredictionOption, crfFileOption, searchWebOption, csvOutputOption, htmlOutputOption, vcfOutputOption, stopListOption, numberHopsOption, readPeopleOption, writePeopleOption, });}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -