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;
}
Aggregations