The invention provides an intelligent contract classification method based on keyword
feature extraction and attention, and the method comprises the steps:
processing codes of intelligent contracts through a long-term and short-
term memory network, carrying out the
feature extraction of corresponding keywords, and combining with an attention mechanism, thereby achieving a purpose of classifying the intelligent contracts; training the intelligent contract into a
content word vector by using a word-to-word vector model Word2Vec, and converting the keyword into a serialized vector by using a vectorized text tool Tokenizer; and putting the serialized vector into a long-term and short-
term memory network, and connecting the final hidden
state vector with each word vector of the intelligent contract; after the connected vectors are subjected to one-layer
convolution operation and one-layer
pooling operation, putting the operated vectors into a long-short-
term memory neural network, and multiplying the final hidden
state vector by a vector generated through attention; and putting the obtained
sentence representation into a long-term and short-term memory neural network, and finally classifying the intelligent contracts by using a softmax classifier; and finally, evaluating the model on the
data set of the Ethereum website by combining the DApps decentralization application program, and proving the effectiveness of the model by an experimental result. The training accuracy reaches 89.1%.