当前位置: 首页>>代码示例>>Java>>正文


Java Debugx类代码示例

本文整理汇总了Java中uk.ac.man.cs.choif.extend.Debugx的典型用法代码示例。如果您正苦于以下问题:Java Debugx类的具体用法?Java Debugx怎么用?Java Debugx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Debugx类属于uk.ac.man.cs.choif.extend包,在下文中一共展示了Debugx类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: segment

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Given a document as a list of elementary text blocks
 * (usually tokenised sentences), segment the document into n 
 * coherent topic segments. If n is -1, the algorithm
 * will decide the appropriate number of segments by
 * monitoring the rate of increase in segment density.
 * Creation date: (11/05/99 05:55:46)
 * @return String[][] A list of coherent topic segments
 * @param String[] A list of elementary text blocks (usually sentences). Each block is a string of space separated tokens.
 * @param n int Number of segments to make, if -1 then let the algorithm decide.
 * @param s int Size of ranking mask, must be >= 3 and an odd number
 */
//modification par Christine Jacquin le 28/09/10 
//avant: méthode final static , maintenant=> rien
public  String[][][] segment(final String[][] document, final int n, final int s) {
Debugx.msg("C99", "Context vectors...");
	ContextVector[] vectors = normalize(document);
	Debugx.msg("C99", "Similarity matrix...");
	/*System.out.println("context vector");	
	for (int i=0; i<vectors.length;i++){
		System.out.println(vectors[i]);
	}
	*/
	float[][] sim = similarity(vectors);
	vectors = null;
	Debugx.msg("C99", "Rank matrix (" + s + "x" + s + " rank mask)...");
	float[][] rank = rank(sim, s);
	sim = null;
	Debugx.msg("C99", "Sum of rank matrix...");
	float[][] sum = sum(rank);
	rank = null;
	Debugx.msg("C99", "Divisive clustering (" + (n==-1 ? "automatic" : "user") + " termination)...");
	int[] B = Arrayx.sortAsc(boundaries(sum, n));
	sum = null;
	Debugx.msg("C99", "Found " + (B.length+1) + " segments...");
	return split(document, B);
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:38,代码来源:C99LINA.java

示例2: segment

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Given a document as a list of elementary text blocks
 * (usually tokenised sentences), segment the document into n 
 * coherent topic segments. If n is -1, the algorithm
 * will decide the appropriate number of segments by
 * monitoring the rate of increase in segment density.
 * Creation date: (11/05/99 05:55:46)
 * @return String[][] A list of coherent topic segments
 * @param String[] A list of elementary text blocks (usually sentences). Each block is a string of space separated tokens.
 * @param n int Number of segments to make, if -1 then let the algorithm decide.
 * @param s int Size of ranking mask, must be >= 3 and an odd number
 */
public final static String[][][] segment(final String[][] document, final int n, final int s) {
	Debugx.msg("C99", "Context vectors...");
	ContextVector[] vectors = normalize(document);
	Debugx.msg("C99", "Similarity matrix...");
	float[][] sim = similarity(vectors);
	vectors = null;
	Debugx.msg("C99", "Rank matrix (" + s + "x" + s + " rank mask)...");
	float[][] rank = rank(sim, s);
	sim = null;
	Debugx.msg("C99", "Sum of rank matrix...");
	float[][] sum = sum(rank);
	rank = null;
	Debugx.msg("C99", "Divisive clustering (" + (n==-1 ? "automatic" : "user") + " termination)...");
	int[] B = Arrayx.sortAsc(boundaries(sum, n));
	sum = null;
	Debugx.msg("C99", "Found " + (B.length+1) + " segments...");
	return split(document, B);
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:31,代码来源:C99.java

示例3: segmentW

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Given a document as a list of elementary text blocks
 * (usually tokenised sentences), segment the document into n 
 * coherent topic segments. If n is -1, the algorithm
 * will decide the appropriate number of segments by
 * monitoring the rate of increase in segment density.
 * Creation date: (11/05/99 05:55:46)
 * @return String[][] A list of coherent topic segments
 * @param String[] A list of elementary text blocks (usually sentences). Each block is a string of space separated tokens.
 * @param n int Number of segments to make, if -1 then let the algorithm decide.
 * @param s int Size of ranking mask, must be >= 3 and an odd number
 */
public final static String[][][] segmentW(final String[][] document, final int n, final int s) {
	Debugx.msg("C99", "Context vectors...");
	ContextVector tf = new ContextVector();
	ContextVector[] vectors = normalize(document, tf);
	Debugx.msg("C99", "Similarity matrix...");
	EntropyVector ev = new EntropyVector(tf);
	float[][] sim = similarity(vectors, ev);
	vectors = null;
	Debugx.msg("C99", "Rank matrix (" + s + "x" + s + " rank mask)...");
	float[][] rank = rank(sim, s);
	sim = null;
	Debugx.msg("C99", "Sum of rank matrix...");
	float[][] sum = sum(rank);
	rank = null;
	Debugx.msg("C99", "Divisive clustering (" + (n==-1 ? "automatic" : "user") + " termination)...");
	int[] B = Arrayx.sortAsc(boundaries(sum, n));
	sum = null;
	Debugx.msg("C99", "Found " + (B.length+1) + " segments...");
	return split(document, B);
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:33,代码来源:C99.java

示例4: segmentW

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Given a document as a list of elementary text blocks
 * (usually tokenised sentences), segment the document into n 
 * coherent topic segments. If n is -1, the algorithm
 * will decide the appropriate number of segments by
 * monitoring the rate of increase in segment density.
 * Creation date: (11/05/99 05:55:46)
 * @return String[][] A list of coherent topic segments
 * @param String[] A list of elementary text blocks (usually sentences). Each block is a string of space separated tokens.
 * @param n int Number of segments to make, if -1 then let the algorithm decide.
 * @param s int Size of ranking mask, must be >= 3 and an odd number
 */

//modification par Christine Jacquin le 28/09/10 
//avant: méthode final static , maintenant=> rien
public  String[][][] segmentW(final String[][] document, final int n, final int s) {
	Debugx.msg("C99", "Context vectors...");
	ContextVector tf = new ContextVector();
	ContextVector[] vectors = normalize(document, tf);
/*	System.out.println("context vector");
	for (int i=0; i<vectors.length;i++){
		System.out.println(vectors[i]);
	}
	*/
	Debugx.msg("C99", "Similarity matrix...");
	EntropyVector ev = new EntropyVector(tf);
	float[][] sim = similarity(vectors, ev);
	vectors = null;
	Debugx.msg("C99", "Rank matrix (" + s + "x" + s + " rank mask)...");
	float[][] rank = rank(sim, s);
	sim = null;
	Debugx.msg("C99", "Sum of rank matrix...");
	float[][] sum = sum(rank);
	rank = null;
	Debugx.msg("C99", "Divisive clustering (" + (n==-1 ? "automatic" : "user") + " termination)...");
	int[] B = Arrayx.sortAsc(boundaries(sum, n));
	sum = null;
	Debugx.msg("C99", "Found " + (B.length+1) + " segments...");
	return split(document, B);
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:41,代码来源:C99LINA.java

示例5: main

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Segment a piece of text using the C99 algorithm
 * Creation date: (11/05/99 06:05:36)
 * @param args java.lang.String[]
 */
public final static void main(String[] args) {
	Debugx.header("This is C99, an algorithm for linear text segmentation.");

	/* Command line arguments processing */
	Argx arg = new Argx(args);
	int n = arg.get("-n", -1, "Number of segments (default automatic = -1)");
	int s = arg.get("-s", 11, "Size of ranking mask (>= 1 and an odd number)");
	boolean w = arg.has("-w", false, "Weight context vector with term frequencies");
	arg.displayHelp();
	if (s < 1 || s % 2 != 1) Debugx.handle(new Error("Parameter -s must be >= 1 and an odd number."));

	/* Load document */
	Debugx.msg("C99", "Loading document...");
	String[][] D = Stringx.tokenize(LineInput.load(new LineInput(System.in)), " ");
	//String[][] D = null;
	//try { D = Stringx.tokenize(LineInput.load(new LineInput(new java.io.File("/root/temp/test.txt"))), " "); }
	//catch (java.io.IOException e) {}

	/* Perform segmentation */
	String[][][] S = (w ? segmentW(D, n, s) : segment(D, n, s));
	Debugx.msg("C99", "Ready.");

	/* Print output */
	final String sep = "==========";
	String line;
	LineOutput out = new LineOutput(System.out);
	for (int i=0, ie=S.length; i<ie; i++) {
		out.println(sep);
		for (int j=0, je=S[i].length; j<je; j++) {
			line = "";
			for (int k=0, ke=S[i][j].length; k<ke; k++) line += (S[i][j][k] + " ");
			out.println(line);
		}
	}
	out.println(sep);
	out.close();
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:43,代码来源:C99.java

示例6: processInputView

import uk.ac.man.cs.choif.extend.Debugx; //导入依赖的package包/类
/**
 * Process input view
 */
//	@Override
protected String processInputView(JCas inputViewJCas,
		FSIterator contextAnnotationsFSIter,
		HashMap<String, Integer> inputAnnotationStringHashMap,
		String inputFeatureString, JCas outputViewJCas,
		String outputAnnotationString, String ouputFeatureString)
throws AnalysisEngineProcessException {
	
	// Store both an array of Sentence annotations, and an (sentence)ArrayOfTokenFeatureArray in private properties
	UIMARawText aUIMARawText = new UIMARawText(inputViewJCas,this.getSentenceAnnotationType(), this.getTokenAnnotationType(), this.getTokenFeature());
	C99Parser aC99ParsedText = new C99Parser(aUIMARawText);

	// Return the sentenceArrayOfTokenFeatureArray property of the C99Parser class as an array of array of String 
	String D[][]=aC99ParsedText.getRawText().transformSentenceArrayOfTokenFeatureArrayToAnArrayOfArrayOfString();
	//Token[][] sentenceArrayOfTokenFeatureArray = rawText.getSentenceArrayOfTokenFeatureArray();

	if (debug) for (int i=0;i<D.length;i++){
		// according to Choi implementation, this a paragraph limit		
		if (D[i]!=null){
			for (int j=0;j<D[i].length;j++){
				System.out.println("Debug: "+i+" "+j+" "+D[i][j]);
			}
		}

	}

	// use of C99 class of Choi to compute the result of the segmentation process
	// for Choi algorithm, a sentence = a line of the text file in entry
	// components of S=> first one: segments, second one=> sentences, third one: tokens
	String[][][] S = (this.getTfWeight() ? aC99ParsedText.segmentW(D, this.getSegment(), this.getRankingMask()) : aC99ParsedText.segment(D, this.getSegment(), this.getRankingMask()));
	if (debug) Debugx.msg("C99", "Ready.");


	//					//	 Print output 
	//					final String sep = "==========";
	//					String lineTmp;		
	//					for (int i=0, ie=S.length; i<ie; i++) {
	//						System.out.println(sep);
	//						for (int j=0, je=S[i].length; j<je; j++) {
	//							
	//							lineTmp = "";
	//							for (int k=0, ke=S[i][j].length; k<ke; k++) {
	//								lineTmp += (S[i][j][k] + " ");
	//								
	//							}
	//							
	//							
	//							System.out.println(lineTmp);
	//						}
	//					}
	//					System.out.println(sep);
	//					

	//annotation of thematic segment

       // For each segment then get the begin and the end of respectively the first and the last sentence of the segment 
	Vector <Annotation> sentenceVector = aC99ParsedText.getRawText().getSentenceAnnotations();
	int index=0;
	for (int i=0; i<S.length; i++){
		int begin = sentenceVector.get(index).getBegin();
		for (int j=0; j<S[i].length; j++){
			// white line are stored in S, so for mapping S and the paragraph annotation we must don't take care of them.
			if (! ((S[i][j].length==1) && (S[i][j][0]==""))){
				index++;
			}
		}
		AnnotationUtils.createAnnotation(inputViewJCas, this.getOutputSegmentAnnotation(), begin, sentenceVector.get(index-1).getEnd());

	}

	// La méthode requiert de retourner quelque chose 
	// Le plus simple est de lui retourner l'image d'elle même
	return inputViewJCas.getSofaDataString();
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:78,代码来源:C99AE.java


注:本文中的uk.ac.man.cs.choif.extend.Debugx类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。