All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.chen0040.plsa.BasicDocument Maven / Gradle / Ivy

The newest version!
package com.github.chen0040.plsa;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * Created by xschen on 9/9/15.
 */
public class BasicDocument implements Document {

    private final Map wordCounts;
    private final List words;
    private String text;
    private int docIndex;

    public BasicDocument(Map wordCounts, String text, int index){
        this.wordCounts = wordCounts;
        this.text = text;
        this.docIndex = index;

        this.words = new ArrayList<>(wordCounts.keySet());
    }

    public Map indexedWordCount(){
        return wordCounts;
    }


    @Override public List wordIndices() {
        return words;
    }

    public String content(){
        return text;
    }

    public int docIndex(){
        return docIndex;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy