Keyword extraction

更新时间:
复制 MD 格式

The Keyword Extraction component identifies the most significant words in a text document and scores them by relevance. Use this component to surface key topics from large volumes of unstructured text without manually reviewing each document.

The component uses the TextRank algorithm: it builds a word co-occurrence network and scores each word using a method similar to PageRank. Words that appear frequently alongside other high-scoring words receive higher scores. For example, in the phrase "high-performance distributed cache," both "high-performance" and "distributed" co-occur with "cache" and with each other, so TextRank rates them as more significant than generic words like "high" or "method" used in isolation.

The processing pipeline is:

  1. Load source data into an input table.

  2. Tokenize the text into words.

  3. Filter out stop words and punctuation.

  4. Run TextRank to score and extract the top keywords.

Configure the component

The Keyword Extraction component supports two configuration methods. Use the Designer GUI for interactive exploration and validation. Use PAI commands when integrating keyword extraction into an automated SQL Script pipeline.

Method 1: Designer GUI

On the Designer workflow page, add the Keyword Extraction component and configure the following parameters in the right-side panel.

Parameter groupParameterRequiredDescription
Fields settingDocument ID columnYesThe column containing document IDs.
Fields settingWord segmentation resultsYesThe column containing tokenized document content.
Parameters settingNumber of keywords to outputNoNumber of top keywords to return. Default: 5.
Parameters settingWindow sizeNoWord co-occurrence window size for TextRank. Default: 2.
Parameters settingDamping coefficientNoTextRank damping coefficient. Default: 0.85.
Parameters settingMaximum iterationsNoMaximum number of TextRank iterations. Default: 100.
Parameters settingConvergence coefficientNoResidual threshold for convergence. Default: 0.000001.
Execution tuningNumber of coresNoWorker count. Auto-assigned by default.
Execution tuningMemory per coreNoMemory per worker, in MB. Auto-assigned by default.

Method 2: PAI commands

Use PAI commands to configure and run Keyword Extraction in a SQL Script component.

PAI -name KeywordsExtraction
    -DinputTableName=maple_test_keywords_basic_input
    -DdocIdCol=docid -DdocContent=word
    -DoutputTableName=maple_test_keywords_basic_output
    -DtopN=19;
ParameterRequiredDefaultDescription
inputTableNameYesThe input table.
inputTablePartitionsNoAll partitionsPartitions to use. Format: Partition_name=value. For multi-level partitions: name1=value1/name2=value2. Separate multiple partitions with commas.
outputTableNameYesThe output table.
docIdColYesThe column containing document IDs. Single column only.
docContentYesThe column containing tokenized words. Single column only.
topNNo5Number of top keywords to return. If the total number of extracted keywords is less than topN, all keywords are returned.
windowSizeNo2Word co-occurrence window size for TextRank.
dumpingFactorNo0.85The damping coefficient for the TextRank algorithm.
maxIterNo100Maximum number of iterations for the TextRank algorithm.
epsilonNo0.000001Convergence residual threshold for the TextRank algorithm.
lifecycleNoLifecycle of the output table.
coreNumNoAutoWorker count.
memSizePerCoreNoAutoMemory per worker, in MB.

Example

This example extracts the top 19 keywords from a technical document about blended-wing-body aircraft.

Step 1: Prepare the input table

The input table requires two columns: docid (document ID) and word (tokenized content). In the word column, separate tokens with spaces and remove stop words (for example, "the" and "a") and all punctuation.

docid:stringword:string
doc0blended-wing-body aircraft is future aviation field development a new direction many research institutions have started on blended-wing-body aircraft research and its fully-automatic shape optimization algorithm has become a new research hot-spot existing achievements basis on top of analyze compare common modeling solving platform usage methods and features design write blended-wing-body aircraft shape optimization geometric modeling grid division flow-field solving shape optimization module compare different algorithms between pros and cons implement blended-wing-body aircraft conceptual-design in shape optimization geometric modeling and grid generation module implement based-on transfinite interpolation grid generation algorithm based-on spline curve modeling method flow-field solving module includes finite difference solver finite element solver and panel method solver among them finite difference solver mainly includes based-on finite difference method potential-flow mathematical modeling based-on Cartesian grid variable step-size difference format derivation Cartesian grid generation index algorithm based-on Cartesian grid Neumann boundary-condition expression form derivation implement based-on finite difference solver two-dimensional airfoil aerodynamic parameters calculation example finite element solver mainly includes based-on variational principle potential-flow finite element theory modeling two-dimensional finite element Kutta condition expression derivation based-on least squares velocity solving algorithm design based-on Gmsh two-dimensional with-wake airfoil spatial grid generator development implement based-on finite element solver two-dimensional airfoil aerodynamic parameters calculation example panel method solver mainly includes based-on panel method potential-flow theory modeling automatic wake generation algorithm design based-on panel method three-dimensional blended-wing-body aircraft flow-field solver development based-on Blasius flat-plate solution drag estimation algorithm design solver Fortran language on port Python and Fortran code mixed-compilation based-on OpenMP and CUDA parallel acceleration algorithm design and development implement based-on panel method solver three-dimensional blended-wing-body aircraft aerodynamic parameters calculation example shape optimization module implemented based-on free form deformation grid deformation algorithm genetic-algorithm differential evolution algorithm aircraft surface-area calculation algorithm based-on moment integration aircraft volume calculation algorithm development based-on VTK data visualization format tool

Step 2: Run the PAI command

PAI -name KeywordsExtraction
    -DinputTableName=maple_test_keywords_basic_input
    -DdocIdCol=docid -DdocContent=word
    -DoutputTableName=maple_test_keywords_basic_output
    -DtopN=19;

Step 3: Review the output

The output table contains three columns: docid, keywords, and weight. The weight value reflects each keyword's relative importance in the document—higher values indicate more central terms. Use the weight to filter keywords by relevance. For example, to focus on the most significant terms, keep only keywords where weight > 0.02.

docidkeywordsweight
doc0based-on0.041306752223538405
doc0algorithm0.03089845626854151
doc0modeling0.021782865850562882
doc0grid0.020669749212693957
doc0solver0.020245609506360847
doc0aircraft0.019850761705313365
doc0research0.014193732541852615
doc0finite element0.013831122054200538
doc0solving0.012924593244133104
doc0module0.01280216562287212
doc0derivation0.011907588923852495
doc0shape0.011505456605632607
doc0difference0.011477831662367547
doc0potential-flow0.010969269350293957
doc0design0.010830986516637251
doc0implement0.010747536556701583
doc0two-dimensional0.010695570768457084
doc0development0.010527342662670088
doc0new0.010096978306668461