Search in sources :

Example 1 with KeywordsExtractionMap

use of com.alibaba.alink.operator.common.nlp.KeywordsExtractionMap in project Alink by alibaba.

the class KeywordsExtractionStreamOp method linkFrom.

@Override
public KeywordsExtractionStreamOp linkFrom(StreamOperator<?>... inputs) {
    StreamOperator<?> in = checkAndGetFirst(inputs);
    String selectedColName = this.getSelectedCol();
    int textColIndex = TableUtil.findColIndexWithAssertAndHint(in.getColNames(), selectedColName);
    String outputColName = this.getOutputCol();
    if (null == outputColName) {
        outputColName = selectedColName;
    }
    OutputColsHelper outputColsHelper = new OutputColsHelper(in.getSchema(), new String[] { outputColName }, new TypeInformation[] { org.apache.flink.table.api.Types.STRING() }, in.getColNames());
    DataStream<Row> res = in.getDataStream().map(new KeywordsExtractionMap(this.getParams(), textColIndex, outputColsHelper));
    // Set the output into table.
    this.setOutput(res, outputColsHelper.getResultSchema());
    return this;
}
Also used : KeywordsExtractionMap(com.alibaba.alink.operator.common.nlp.KeywordsExtractionMap) Row(org.apache.flink.types.Row) OutputColsHelper(com.alibaba.alink.common.utils.OutputColsHelper)

Aggregations

OutputColsHelper (com.alibaba.alink.common.utils.OutputColsHelper)1 KeywordsExtractionMap (com.alibaba.alink.operator.common.nlp.KeywordsExtractionMap)1 Row (org.apache.flink.types.Row)1