Text Mining in Program Code

Text Mining in Program Code

Alexander Dreweke (Friedrich-Alexander University Erlangen-Nuremberg, Germany), Ingrid Fischer (University of Konstanz, Germany), Tobias Werth (Friedrich-Alexander University Erlangen-Nuremberg, Germany) and Marc Wörlein (Friedrich-Alexander University Erlangen-Nuremberg, Germany)
Copyright: © 2009 |Pages: 20
DOI: 10.4018/978-1-59904-990-8.ch035
OnDemand PDF Download:
$37.50

Abstract

Searching for frequent pieces in a database with some sort of text is a well-known problem. A special sort of text is program code as e.g. C++ or machine code for embedded systems. Filtering out duplicates in large software projects leads to more understandable programs and helps avoiding mistakes when reengineering the program. On embedded systems the size of the machine code is an important issue. To ensure small programs, duplicates must be avoided. Several different approaches for finding code duplicates based on the text representation of the code or on graphs representing the data and control flow of the program and graph mining algorithms.
Chapter Preview
Top

Introduction

Computer programs are a special form of text. Words of a programming languages are combined to form correct sentences in this programming language. There exists a wide variety of programming languages, ranging from high-level object-oriented languages like Java or C++ to machine code, the language a processor can actually “understand”. Programming languages are usually translated with the help of compilers from high- to low-level. To produce this kind of “text” - the computer programs - is the daily work of many programmers; billions of lines of code have been written. Mostly, this code is not well documented and not really understood by anybody after the original programmer stopped working. Typically, many programmers are working on one project and often old code from former versions or other projects is used.

Duplicated code fragments are a special problem in big amounts of program code. These duplicated fragments can occur because of excessive use of “copy & paste”, because something was simply re-programmed or also because of the compiler. When translating from the high-level to intermediate or low-level languages, new duplicates can be introduced, e.g. by using code templates for instructions and instruction sequences.

Finding these duplicates has been in the focus of interest for many years. Code duplicates are called clones and clone detection has produced many different algorithms. If program code is simply viewed as text, clone detection is nothing else than mining in this text with the goal of finding the duplicate or similar code. Merging application areas and algorithms from the data mining community on the one hand and clone detection leads to fruitful new insights and results.

Finding duplicated code in programs can have different goals. First these duplicates can be visualized as a hint for programmers that something has to be done about this specific piece of code. Second, the redundant code can be replaced automatically by subroutine calls, in-lined procedure calls, and macros etc. that produce the same result. This leads to smaller code that is easier to understand or to maintain. Third, methods to detect and replace duplicated code can be integrated into compilers. Finally, finding duplicated code can lead to special hardware for the duplicates in the area of embedded systems.

In the case of program code, duplicates are not always “totally equivalent”. It is not only the one-to-one duplicate from a piece of code that is interesting. Also near duplicates or even pieces of code, that are syntactically different, but semantically equivalent must be found. E.g. in two fragments only two independent pieces of code having no side effect onto each other can be exchanged. Variable names can be different or registers in machine code can vary.

The application of clone detection ranges from high-level languages to machine code for embedded systems. The latter is the main topic in this chapter. The clone detection algorithms especially for embedded systems are described in detail.

Key Terms in this Chapter

Graph Mining: Methods to identify frequent subgraphs in a given graph database.

Code Compaction: The code size reduction of binaries in order to save manufacturing costs or of source code in order to increase maintainability

Clone Detection: Methods to identify code clones i.e. a sequence or set of instructions that is similar or even identical to another one in different kinds of programming code.

Embedded System: Unlike general purpose systems, an Embedded System is used and built for special purpose with special requirements (e.g. real-time operation) and is produced with a large number of units. Therefore, tiny cost savings per piece pay off often.

Suffix Tree: A suffix tree is a data structure used for an efficient detection of duplicated strings in a text.

Slicing: Method to identify code clones based on a CDFG of the program. Based on instructions or their operational code isomorphic subgraphs are grown; similar to graph mining.

Control Data Flow Graph (CDFG): Represents the control flow and the data dependencies in a program.

Procedural Abstraction: The extraction code clones into functions and replacing their occurrences by calls to these new functions.

Fingerprinting: Code fragments are associated with numerical (hash) codes to speed up the detection of code clones. If two code blocks are identical, they have the same fingerprints. If two code blocks have identical fingerprints, these blocks do not necessarily have to be identical.

Regularity Extraction: The realization of code clones in hard logic on an embedded system.

Complete Chapter List

Search this Book:
Reset
Editorial Advisory Board
Table of Contents
Foreword
Xiaohua Hu
Preface
Min Song, Yi-Fang Brook Wu
Acknowledgment
Min Song, Yi-Fang Brook Wu
Chapter 1
Ying Liu
In the automated text classification, a bag-of-words representation followed by the tfidf weighting is the most popular approach to convert the... Sample PDF
On Document Representation and Term Weights in Text Classification
$37.50
Chapter 2
Yi-fang Brook Wu, Quanzhi Li
Document keyphrases provide semantic metadata which can characterize documents and produce an overview of the content of a document. This chapter... Sample PDF
Deriving Document Keyphrases for Text Mining
$37.50
Chapter 3
John Atkinson
This chapter introduces a novel evolutionary model for intelligent text mining. The model deals with issues concerning shallow text representation... Sample PDF
Intelligent Text Mining: Putting Evolutionary Methods and Language Technologies Together
$37.50
Chapter 4
Xiaoyan Yu, Manas Tungare, Weigo Yuan, Yubo Yuan, Manuel Pérez-Quiñones, Edward A. Fox
Syllabi are important educational resources. Gathering syllabi that are freely available and creating useful services on top of the collection... Sample PDF
Automatic Syllabus Classification Using Support Vector Machines
$37.50
Chapter 5
Xiao-Li Li
In traditional text categorization, a classifier is built using labeled training documents from a set of predefined classes. This chapter studies a... Sample PDF
Partially Supervised Text Categorization
$37.50
Chapter 6
Yu-Jin Zhang
Mining techniques can play an important role in automatic image classification and content-based retrieval. A novel method for image classification... Sample PDF
Image Classification and Retrieval with Mining Technologies
$37.50
Chapter 7
Han-joon Kim
This chapter introduces two practical techniques for improving Naïve Bayes text classifiers that are widely used for text classification. The Naïve... Sample PDF
Improving Techniques for Naïve Bayes Text Classifiers
$37.50
Chapter 8
Ricco Rakotomalala, Faouzi Mhamdi
In this chapter, we are interested in proteins classification starting from their primary structures. The goal is to automatically affect proteins... Sample PDF
Using the Text Categorization Framework for Protein Classification
$37.50
Chapter 9
Wilson Wong
Feature-based semantic measurements have played a dominant role in conventional data clustering algorithms for many existing applications. However... Sample PDF
Featureless Data Clustering
$37.50
Chapter 10
Xiaohui Cui
In this chapter, we introduce three nature inspired swarm intelligence clustering approaches for document clustering analysis. The major challenge... Sample PDF
Swarm Intelligence in Text Document Clustering
$37.50
Chapter 11
P. Viswanth
Clustering is a process of finding natural grouping present in a dataset. Various clustering methods are proposed to work with various types of... Sample PDF
Some Efficient and Fast Approaches to Document Clustering
$37.50
Chapter 12
Abdelmalek Amine, Zakaria Elberrichi, Michel Simonet, Ladjel Bellatreche, Mimoun Malki
The classification of textual documents has been the subject of many studies. Technologies like the Web and numerical libraries facilitated the... Sample PDF
SOM-Based Clustering of Textual Documents Using WordNet
$37.50
Chapter 13
Lean Yu, Shouyang Wang, Kin Keung Lai
With the rapid increase of the huge amount of online information, there is a strong demand for Web text mining which helps people discover some... Sample PDF
A Multi-Agent Neural Network System for Web Text Mining
$37.50
Chapter 14
Sangeetha Kutty
With the emergence of XML standardization, XML documents have been widely used and accepted in almost all the major industries. As a result of the... Sample PDF
Frequent Mining on XML Documents
$37.50
Chapter 15
Richi Nayak
XML has gained popularity for information representation, exchange and retrieval. As XML material becomes more abundant, its heterogeneity and... Sample PDF
The Process and Application of XML Data Mining
$37.50
Chapter 16
Francesco Buccafurri
In the context of Knowledge Discovery in Databases, data reduction is a pre-processing step delivering succinct yet meaningful data to sequent... Sample PDF
Approximate Range Querying over Sliding Windows
$37.50
Chapter 17
Jan H. Kroeze
This chapter discusses the application of some data warehousing techniques on a data cube of linguistic data. The results of various modules of... Sample PDF
Slicing and Dicing a Linguistic Data Cube
$37.50
Chapter 18
Yi-fang Brook Wu, Xin Chen
This chapter presents a methodology for personalized knowledge discovery from text. Traditionally, problems with text mining are numerous rules... Sample PDF
Discovering Personalized Novel Knowledge from Text
$37.50
Chapter 19
Catia Pesquita
Biomedical research generates a vast amount of information that is ultimately stored in scientific publications or in databases. The information in... Sample PDF
Untangling BioOntologies for Mining Biomedical Information
$37.50
Chapter 20
Luis M. de Campos
In this chapter, we present a thesaurus application in the field of text mining and more specifically automatic indexing on the set of descriptors... Sample PDF
Thesaurus-Based Automatic Indexing
$37.50
Chapter 21
Concept-Based Text Mining  (pages 346-358)
Stanley Loh, Leandro Krug Wives, Daniel Lichtnow, José Palazzo M. de Oliveira
The goal of this chapter is to present an approach to mine texts through the analysis of higher level characteristics (called “concepts’)... Sample PDF
Concept-Based Text Mining
$37.50
Chapter 22
Marcello Pecoraro
This chapter aims at providing an overview about the use of statistical methods supporting the Web Usage Mining. Within the first part is described... Sample PDF
Statistical Methods for User Profiling in Web Usage Mining
$37.50
Chapter 23
Quanzhi Li, Yi-fang Brook Wu
This chapter presents a new approach of mining the Web to identify people of similar background. To find similar people from the Web for a given... Sample PDF
Web Mining to Identify People of Similar Background
$37.50
Chapter 24
Pawan Lingras
This chapter describes how Web usage patterns can be used to improve the navigational structure of a Web site. The discussion begins with an... Sample PDF
Hyperlink Structure Inspired by Web Usage
$37.50
Chapter 25
Rosa Meo, Maristella Matera
In this chapter, we present the usage of a modeling language, WebML, for the design and the management of dynamic Web applications. WebML also makes... Sample PDF
Designing and Mining Web Applications: A Conceptual Modeling Approach
$37.50
Chapter 26
Brigitte Trousse, Marie-Aude Aufaure, Bénédicte Le Grand, Yves Lechevallier, Florent Masseglia
This chapter proposes an original approach for ontology management in the context of Web-based information systems. Our approach relies on the usage... Sample PDF
Web Usage Mining for Ontology Management
$37.50
Chapter 27
Yue-Shi Lee
Web mining is one of the mining technologies, which applies data mining techniques in large amounts of Web data to improve the Web services. Web... Sample PDF
A Lattice-Based Framework for Interactively and Incrementally Mining Web Traversal Patterns
$37.50
Chapter 28
Stanley R.M. Oliveira, Osmar R. Zaïane
Privacy-preserving data mining (PPDM) is one of the newest trends in privacy and security research. It is driven by one of the major policy issues... Sample PDF
Privacy-Preserving Data Mining on the Web: Foundations and Techniques
$37.50
Chapter 29
G.S. Mahalakshmi, S. Sendhilkumar
Automatic reference tracking involves systematic tracking of reference articles listed for a particular research paper by extracting the references... Sample PDF
Automatic Reference Tracking
$37.50
Chapter 30
Wilson Wong
As more electronic text is readily available, and more applications become knowledge intensive and ontology-enabled, term extraction, also known as... Sample PDF
Determination of Unithood and Termhood for Term Recognition
$37.50
Chapter 31
Fotis Lazarinis
Over 60% of the online population are non-English speakers and it is probable the number of non-English speakers is growing faster than English... Sample PDF
Retrieving Non-Latin Information in a Latin Web: The Case of Greek
$37.50
Chapter 32
Anne Kao
Latent Semantic Analysis (LSA) or Latent Semantic Indexing (LSI), when applied to information retrieval, has been a major analysis approach in text... Sample PDF
Latent Semantic Analysis and Beyond
$37.50
Chapter 33
Ganesh Ramakrishnan, Pushpak Bhattacharyya
Text mining systems such as categorizers and query retrievers of the first generation were largely hinged on word level statistics and provided a... Sample PDF
Question Answering Using Word Associations
$37.50
Chapter 34
Giuseppe Manco, Riccardo Ortale, Andrea Tagarelli
Personalization is aimed at adapting content delivery to users’ profiles: namely, their expectations, preferences and requirements. This chapter... Sample PDF
The Scent of a Newsgroup: Providing Personalized Access to Usenet Sites through Web Mining
$37.50
Chapter 35
Alexander Dreweke, Ingrid Fischer, Tobias Werth, Marc Wörlein
Searching for frequent pieces in a database with some sort of text is a well-known problem. A special sort of text is program code as e.g. C++ or... Sample PDF
Text Mining in Program Code
$37.50
Chapter 36
Nitin Agarwal, Huan Liu, Jianping Zhang
In Golbeck and Hendler (2006), authors consider those social friendship networking sites where users explicitly provide trust ratings to other... Sample PDF
A Study of Friendship Networks and Blogosphere
$37.50
Chapter 37
Pasquale De Meo
In this chapter we present an information system conceived for supporting managers of Public Health Care Agencies to decide the new health care... Sample PDF
An HL7-Aware Decision Support System for E-Health
$37.50
Chapter 38
Diego Liberati
Building effective multitarget classifiers is still an on-going research issue: this chapter proposes the use of the knowledge gleaned from a human... Sample PDF
Multitarget Classifiers for Mining in Bioinformatics
$37.50
Chapter 39
Shuting Xu
Text mining is an instrumental technology that today’s organizations can employ to extract information and further evolve and create valuable... Sample PDF
Current Issues and Future Analysis in Text Mining for Information Security Applications
$37.50
Chapter 40
E. Thirumaran
This chapter introduces Collaborative filtering-based recommendation systems, which has become an integral part of E-commerce applications, as can... Sample PDF
Collaborative Filtering Based Recommendation Systems
$37.50
Chapter 41
Hanna Suominen
The purpose of this chapter is to provide an overview of prevalent measures for evaluating the quality of system output in seven key text mining... Sample PDF
Performance Evaluation Measures for Text Mining
$37.50
Chapter 42
Yanliang Qi
The biology literatures have been increased in an exponential growth in recent year. The researchers need an effective tool to help them find out... Sample PDF
Text Mining in Bioinformatics: Research and Application
$37.50
Chapter 43
Ki Jung Lee
With the increased use of Internet, a large number of consumers first consult on line resources for their healthcare decisions. The problem of the... Sample PDF
Literature Review in Computational Linguistics Issues in the Developing Field of Consumer Informatics: Finding the Right Information for Consumer's Health Information Need
$37.50
Chapter 44
Richard S. Segall
This chapter presents background on text mining, and comparisons and summaries of seven selected software for text mining. The text mining software... Sample PDF
A Survey of Selected Software Technologies for Text Mining
$37.50
Chapter 45
Ah Chung Tsoi, Phuong Kim To, Markus Hagenbuchner
This chapter describes the application of a number of text mining techniques to discover patterns in the health insurance schedule with an aim to... Sample PDF
Application of Text Mining Methodologies to Health Insurance Schedules
$37.50
Chapter 46
Miao-Ling Wang, Hsiao-Fan Wang
With the ever-increasing and ever-changing flow of information available on the Web, information analysis has never been more important. Web text... Sample PDF
Web Mining System for Mobile-Phone Marketing
$37.50
Chapter 47
Neil Davis
Text mining technology can be used to assist in finding relevant or novel information in large volumes of unstructured data, such as that which is... Sample PDF
Web Service Architectures for Text Mining: An Exploration of the Issues via an E-Science Demonstrator
$37.50
About the Editors
About the Contributors