當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。