该文档涉及的组件

    Text文本内容数据源(TextContentSourceBatchOp)

    Java 类名:org.alinklab.operator.batch.source.TextContentSourceBatchOp

    Python 类名:TextContentSourceBatchOp

    功能介绍

    Text文本读入

    参数说明

    名称 中文名称 描述 类型 是否必须? 取值范围 默认值
    textContent 文本内容 文本内容 String ✓
    rowDelimiter 行分隔符 行分隔符 String It can’t be empty string. \n
    skipBlankLine 是否忽略空行 是否忽略空行 Boolean true
    textCol 文本列名称 文本列名称 String text

    代码示例

    Java 代码

    import com.alibaba.alink.common.utils.JsonConverter;
    import com.alibaba.alink.operator.batch.BatchOperator;
    import junit.framework.TestCase;
    
    public class TextContentSourceBatchOpTest extends TestCase {
    
        public void test() {
            String text = "噢耶~噢耶\n" +
                "\n" +
                "对哦 对哦";
            BatchOperator<?> op = new TextContentSourceBatchOp()
                .setTextContent(text)
                .setTextCol("col")
                .setSkipBlankLine(false);
            op.print();
        }
        
    }
    

    输出结果

    col
    噢耶~噢耶

    ||
    |对哦 对哦|