Abstract
An application research work has improved the functions of the FileScanner software within the Pro/3 expert system shell by exploring the transformation of semi-structured HTML files into structured text files. Critical problems, including line feed failures in Windows environments and the incorrect display of Chinese characters, were resolved through targeted Java programming improvements. The resulting structured text files implement effective line feeds and correct character encoding, allowing for direct interaction with databases and other application programs. This enhancement facilitates the analysis of semi-structured data and the mining of valuable information from web-based sources.
Introduction: The Challenge of Semi-Structured Data
In the modern era of Big Data, a significant portion of available information is "semi-structured." HTML files, for instance, often contain valuable data tables wrapped in complex and inconsistent tags. To make this information useful for automated analysis, it must be converted into a "structured" format—such as a clean .txt or .csv file—that databases and expert systems can readily ingest.
The researchers identified that the existing FileScanner tool, a component of the Pro/3 expert system shell, suffered from two major technical hurdles:
- Formatting Failures: In Windows environments, the tool struggled with line feeds, often producing unreadable blocks of text or files filled with extraneous "0" characters.
- Encoding Issues: The software frequently garbled Chinese characters because it lacked a robust mechanism to distinguish between different encoding standards like UTF-8 and GBK.
Methodology: Enhancing the FileScanner Tool
To address these issues, the research team implemented several Java-based improvements to the FileScanner source code. These changes were designed to automate data cleaning and ensure cross-platform compatibility.
Technical Improvements
- Line Feed Correction: The standard Unix-style newline (
\n) was replaced with the Windows-compatible carriage return and line feed (\r\n). This ensures that the resulting text files open correctly in standard Windows text editors without formatting loss. - Data Cleaning Logic: Logic was added to the transformation script to automatically identify and strip out "0" characters and unnecessary empty lines during the scanning process, resulting in a much cleaner output.
- Automatic Encoding Detection: The software now reads the first three bytes of a file to check for a specific Byte Order Mark (BOM) signature (-17, -69, -65). If this signature is found, the file is identified as UTF-8; otherwise, it defaults to GBK. This allows the
BufferedReaderto process Chinese characters accurately.
Structured Mapping
The tool utilizes a "format file" (.3ff) that defines specific tags to map HTML elements directly to structured data fields. This allows the software to recognize the hierarchy of the data being processed.
Implementation and Workflow
The transformation process follows a logical flow, starting with file preprocessing and moving through a loop of record scanning and output generation until the end of the input file is reached.
Results and Key Insights
The authors successfully demonstrated the transition from messy HTML tables to polished, structured text files. The improved software can now be invoked via command line or within the Pro/3 shell to process batches of files automatically.
A key insight from this research is the importance of the "last mile" in data preparation. Even powerful expert systems are limited by the quality of their data ingestion. Small bugs in character encoding or line formatting can break an entire data pipeline. By implementing BOM-based detection and automated cleaning, the researchers have eliminated the need for manual data scrubbing, significantly improving the interoperability of the Pro/3 system with external databases.
Conclusion
The improved FileScanner tool provides a reliable method for converting semi-structured web data into a format suitable for high-level analysis. While the current implementation focuses on specific challenges within the Pro/3 environment, the underlying logic for encoding detection and automated formatting provides a blueprint for more generalized data pre-processing tools. Future work may explore the scalability of this approach for high-volume data streams and more complex, dynamically generated HTML structures.
Summary updated