This method restores ParagraphVectors model previously saved with writeParagraphVectors()

@return
512822
public static ParagraphVectors readParagraphVectors(InputStream stream) throws IOException {
        File tmpFile = DL4JFileUtils.createTempFile("restore", "paravec");
        try {
            FileUtils.copyInputStreamToFile(stream, tmpFile);
            return readParagraphVectors(tmpFile);
        } finally {
            tmpFile.delete();
        }
    }
857421
def cleanParagraph(self):
        

        runs = self.block.content

        if not runs:
            self.block = None
            return

        if not self.clean_paragraphs:
            return

        joinedRuns = []
        hasContent = False

        for run in runs:

            if run.content[0]:
                hasContent = True
            else:
                continue

            # For whitespace-only groups, remove any property stuff,
            # to avoid extra markup in output
            if not run.content[0].strip():
                run.properties = {}

            # Join runs only if their properties match
            if joinedRuns and (run.properties == joinedRuns[-1].properties):
                joinedRuns[-1].content[0] += run.content[0]
            else:
                joinedRuns.append(run)

        if hasContent:
            # Strip beginning of paragraph
            joinedRuns[0].content[0] = joinedRuns[0].content[0].lstrip()
            # And then strip the end
            joinedRuns[-1].content[0] = joinedRuns[-1].content[0].rstrip()
            self.block.content = joinedRuns
        else:
            self.block = None
880336
@Override
    public INDArray getWordVectors(Collection<String> labels) {
        List<INDArray> words = new ArrayList<>();
        for (String label : labels) {
            if (hasWord(label) || getUNK() != null)
                words.add(getWordVectorMatrix(label));
        }

        return Nd4j.vstack(words);
    }
43679
public void replace(BlockVector writeList)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "replace", writeList);

    boolean pushed = false;

    // examine lowest and highest stamp of writeList
    int wlength = writeList.size();
    long fstamp = ((RangeObject) writeList.get(0)).startstamp;
    long lstamp = ((RangeObject) writeList.get(wlength - 1)).endstamp;

    // Set index to position of this low. Using linear search as usually
    // called after a get() that has set the cursor to a 'good' index.

    int findex = linearSearch(fstamp, 0, blockVector.size() - 1);
    int lindex;
    RangeObject lastro;
    for (lindex = findex;; lindex++)
    {
      lastro = (RangeObject) blockVector.get(lindex);
      if ((lstamp <= lastro.endstamp) && (lstamp >= lastro.startstamp))
        break;
    }
    int index, count;
    if (findex == lindex)
    {
      if ((fstamp > lastro.startstamp) && (lstamp < lastro.endstamp))
      {
        // need to clone lastro
        RangeObject ro2 = (RangeObject) lastro.clone();
        ro2.startstamp = lstamp + 1;
        //and push it onto end of writeList
        writeList.add(ro2);
        wlength++;
        pushed = true;
        // adjust lastro.endstamp
        // lastro = (RangeObject) lastro.clone(); *no cloning unless necessary*
        lastro.endstamp = fstamp - 1;
        // blockVector.m_data[findex] = lastro; *no cloning unless necessary*
        // set the index to point to where need to add to put writeList
        index = findex + 1;
        count = wlength; // space to be created/destroyed
      }
      else
        if (fstamp > lastro.startstamp)
        {
          // adjust lastro.endstamp
          // lastro = (RangeObject) lastro.clone(); *no cloning unless necessary*
          lastro.endstamp = fstamp - 1;
          // blockVector.m_data[findex] = lastro; *no cloning unless necessary*
          // set the index to point to where need to add to put writeList
          index = findex + 1;
          count = wlength; // space to be created/destroyed
        }
        else
          if (lstamp < lastro.endstamp)
          {
            // adjust lastro.startstamp
            // lastro = (RangeObject) lastro.clone(); *no cloning unless necessary*
            lastro.startstamp = lstamp + 1;
            // blockVector.m_data[findex] = lastro; *no cloning unless necessary*
            // set the index to point to where need to add to put writeList
            index = findex;
            count = wlength; // space to be created/destroyed
          }
          else
          {
            // need to remove lastro
            index = findex;
            count = wlength - 1;
          }
    }
    else
    { // lindex > findex
      // in the worst case (lindex - findex + 1) elements will be replaced by
      // wlength elements, so only need the following extra space
      count = wlength - (lindex - findex + 1);
      index = findex;
      // adjust range in object at findex or remove it
      RangeObject firstro = (RangeObject) blockVector.get(findex);
      if (fstamp > firstro.startstamp)
      {
        // adjust firstro.endstamp
        // firstro = (RangeObject) firstro.clone();
        firstro.endstamp = fstamp - 1;
        // blockVector.m_data[findex] = firstro;
        // set the index to point to where need to add to put writeList
        index++;
        count++; // the element at findex will not be removed
      }
      // adjust range in object at lindex or remove it
      if (lstamp < lastro.endstamp)
      {
        // adjust lastro.startstamp
        // lastro = (RangeObject) lastro.clone();
        lastro.startstamp = lstamp + 1;
        // blockVector.m_data[lindex] = lastro;
        count++;
      }
    }

    // now do the removal and addition in one-shot
    if (count > 0)
      blockVector.insertNullElementsAt(index, count);
    else
      if (count < 0)
      {
        count = -count;
        blockVector.removeElementsAt(index, count);
      }

    // put the stuff in writeList into blockVector
    for (int i = 0; i < writeList.size(); i++)
    {
      if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "Setting " + writeList.get(i) + " at index " + (i+ index) );
      
      blockVector.set(i + index, writeList.get(i));
      
      // Just to make sure that worked (see 240699)
      if(blockVector.get(i + index) == null)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          SibTr.exit(tc, "replace", "SIErrorException: null range at index " + (i + index));
        
        throw new SIErrorException( 
          nls.getFormattedMessage( 
          "INTERNAL_MESSAGING_ERROR_CWSIP0005", 
          new Object[] { "ARangeList", 
                         "1:347:1.25", 
                         "Null range at index " + (i + index)},  
          null)); 
      }
    }
    if (pushed) // remove the extraneous element pushed onto the end of writeList
      writeList.remove(writeList.size() - 1);

    cursor = index;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "replace", Integer.valueOf(cursor));
  }
925471
@Override protected void postProcessing() {
        if (argOptions.hasOption("saveVectors")) {
            String fileName = argOptions.getStringOption("saveVectors");
            LOGGER.info("saving index vectors to " + fileName);
            IndexVectorUtil.save(isa.getWordToIndexVector(), 
                                 new File(fileName));
        }        
    }
1208764
public DataSet getDataSet()
    {
        if(!noMoreAdding)
        {
            initialLoad();
            finishAdding();
        }
        
        List<DataPoint> dataPoints= new ArrayList<DataPoint>(vectors.size());
        
        for(SparseVector vec : vectors)
            dataPoints.add(new DataPoint(vec, new int[0], new CategoricalData[0]));
        
        return new SimpleDataSet(dataPoints);
    }

    @Override
    public Vec newText(String input)
    {
        return getTextVectorCreator().newText(input);
    }

    @Override
    public Vec newText(String input, StringBuilder workSpace, List<String> storageSpace)
    {
        return getTextVectorCreator().newText(input, workSpace, storageSpace);
    }
        
    /**
     * Returns the {@link TextVectorCreator} used by this data loader to convert
     * documents into vectors. 
     * 
     * @return the text vector creator used by this class
     */
    public TextVectorCreator getTextVectorCreator()
    {
        if(!noMoreAdding)
            throw new RuntimeException("Initial documents have not yet loaded");
        return tvc;
    }
    
}
855376
public static List<Writable> toArrowWritablesSingle(List<FieldVector> fieldVectors,Schema schema) {
        return toArrowWritables(fieldVectors,schema).get(0);
    }
1160555
public ArrayList<String> serialize() {
    ArrayList<String> params = new ArrayList<>();
    for(ParameterPair pair : parameters) {
      params.add(SerializedParameterization.OPTION_PREFIX + pair.option.toString());
      if(pair.value instanceof String) {
        params.add((String) pair.value);
      }
      else if(pair.value instanceof Class) {
        params.add(((Class<?>) pair.value).getCanonicalName());
      }
      else { // Fallback:
        params.add(pair.value.toString());
      }
    }
    return params;
  }
1336207
private function postExtractionCleanup(): self {
        $this->addSiblings($this->article()->getTopNode());

        foreach ($this->article()->getTopNode()->contents() as $node) {
            if ($node->is(self::$CLEANUP_IGNORE_SELECTOR)) {
                if ($this->isHighLinkDensity($node)
                    || $this->isTableTagAndNoParagraphsExist($node)
                    || !$this->isNodeScoreThreshholdMet($this->article()->getTopNode(), $node)) {
                    $node->remove();
                }
            }
        }

        return $this;
    }
364707
public static Vector<Object> toXmlRpcReferencesParameters(Collection<Reference> references)
    { 
        Vector<Object> referencesParams = new Vector<Object>();        
        for(Reference reference : references)
        {
            referencesParams.add(reference.marshallize());
        }
        
        return referencesParams;
    }
333615
public ModelDef[] correct(){
		for(ModelDef m : modelList){
			this.model = m;
			correct1to1Detail();
		}
		for(ModelDef m : modelList){
			this.model = m;
			removeUnnecessaryHasOneToSelf();
		}
		for(ModelDef m : modelList){
			this.model = m;
			removeUnnecessaryHasManyToSelf();
		}
		for(ModelDef m : modelList){
			this.model = m;
			crossOutLinkerTables();
		}
		for(ModelDef m : modelList){
			this.model = m;
			removeHasOneToBothPrimaryAndForeignKey();
		}
		return modelList;
	}
972452
public DataSet getDataSet()
    {
        if(!noMoreAdding)
        {
            initialLoad();
            finishAdding();
        }
        
        List<DataPoint> dataPoints= new ArrayList<DataPoint>(vectors.size());
        
        for(SparseVector vec : vectors)
            dataPoints.add(new DataPoint(vec, new int[0], new CategoricalData[0]));
        
        return new SimpleDataSet(dataPoints);
    }
    
    /**
     * To be called after all original texts have been loaded. 
     * 
     * @param text the text of the document to create a document vector from
     * @return the sparce vector representing this document 
     */
    @Override
    public Vec newText(String text)
    {
        if(!noMoreAdding)
            throw new RuntimeException("Initial documents have not yet loaded");
        return getTextVectorCreator().newText(text);
    }

    @Override
    public Vec newText(String input, StringBuilder workSpace, List<String> storageSpace)
    {
        if(!noMoreAdding)
            throw new RuntimeException("Initial documents have not yet loaded");
        return getTextVectorCreator().newText(input, workSpace, storageSpace);
    }
    
    /**
     * Returns the {@link TextVectorCreator} used by this data loader to convert
     * documents into vectors. 
     * 
     * @return the text vector creator used by this class
     */
    public TextVectorCreator getTextVectorCreator()
    {
        if(!noMoreAdding)
            throw new RuntimeException("Initial documents have not yet loaded");
        else if(tvc == null)
            tvc = new BasicTextVectorCreator(tokenizer, wordIndex, weighting);
        return tvc;
    }
    
    /**
     * Returns the original token for the given index in the data set
     * @param index the numeric feature index
     * @return the word token associated with the index
     */
    public String getWordForIndex(int index)
    {
        //lazy population of allWords array
        if(allWords.size() != wordIndex.size())//we added since this was done
        {
            while(allWords.size() < wordIndex.size())
                allWords.add("");
            for(Map.Entry<String, Integer> entry : wordIndex.entrySet())
                allWords.set(entry.getValue(), entry.getKey());
        }
        if(index >= 0 && index < allWords.size())
            return allWords.get(index);
        else
            return null;
    }
    
    /**
     * Return the number of times a token has been seen in the document
     * @param index the numeric feature index 
     * @return the total occurrence count for the feature
     */
    public int getTermFrequency(int index)
    {
        return termDocumentFrequencys.get(index).get();
    }
    
    /**
     * Creates a new transform factory to remove all features for tokens that 
     * did not occur a certain number of times
     * @param minCount the minimum number of occurrences to be kept as a feature
     * @return a transform factory for removing features that did not occur 
     * often enough
     */
    @SuppressWarnings("unchecked")
    public RemoveAttributeTransform getMinimumOccurrenceDTF(int minCount)
    {
        
        final Set<Integer> numericToRemove = new IntSet();
        for(int i = 0; i < termDocumentFrequencys.size(); i++)
            if(termDocumentFrequencys.get(i).get() < minCount)
                numericToRemove.add(i);
        
        return new RemoveAttributeTransform(Collections.EMPTY_SET, numericToRemove);
    }
}
1227047
public static <T> Reducer<PersistentList<T>,T> toPersistentVector() {
        return Reducer.fromMonoid(Monoids.concatPersistentCollection(Vector.empty()), a -> Vector.of(a));
    }
501452
public ArrayList<RepairDigramRecord> toList() {
    ArrayList<RepairDigramRecord> res = new ArrayList<RepairDigramRecord>(this.elements.size());
    RepairQueueNode cp = this.head;
    while (null != cp) {
      res.add(cp.payload);
      cp = cp.next;
    }
    return res;
  }
932947
public ModelAdapter<?, Item> clear() {
        if (mOriginalItems != null) {
            mOriginalItems.clear();
            publishResults(mConstraint, performFiltering(mConstraint));
            return mItemAdapter;
        } else {
            return mItemAdapter.clear();
        }
    }
1142692
@Override
  public DynamicFactorGraph getModelFromParameters(SufficientStatistics parameters) {
    List<SufficientStatistics> parameterList = parameters.coerceToList().getStatistics();
    Preconditions.checkArgument(parameterList.size() == parametricFactors.size());
    List<PlateFactor> plateFactors = Lists.newArrayList();
    for (int i = 0; i < parameterList.size(); i++) {
      plateFactors.add(new ReplicatedFactor(
          parametricFactors.get(i).getModelFromParameters(parameterList.get(i)),
          factorPatterns.get(i)));
    }
    return baseFactorGraph.addPlateFactors(plateFactors, factorNames.items());
  }
102372
@Nonnull
    public List<OutputWriter> getEffectiveOutputWriters() {
        // Google Guava predicates would be nicer but we don't include guava to ease embeddability
        List<OutputWriter> result = new ArrayList<OutputWriter>(embeddedJmxTrans.getOutputWriters().size() + outputWriters.size());
        for (OutputWriter outputWriter : embeddedJmxTrans.getOutputWriters()) {
            if (outputWriter.isEnabled()) {
                result.add(outputWriter);
            }
        }
        for (OutputWriter outputWriter : outputWriters) {
            if (outputWriter.isEnabled()) {
                result.add(outputWriter);
            }
        }
        return result;
    }