# Smart Contract Generation Assisted by AI-Based Word Segmentation
## 4 Ai-Assisted Smart Contract Generation Approach (AIASCG)  
### Framework Overview  
The proposed AI-Assisted Smart Contract Generation Approach (AIASCG) is a novel solution to fast and reliable smart contract generation for IDLC. It facilitates collaborative contract drafting by contracting parties, who use MNL to translate between natural languages to unambiguously negotiate the content. As shown in Figure 1, AIASCG consists of two processes: machine-readable sentence generation and case phrase generation. While they inherit the MNL sentence generation processes introduced in [6], AIASCG automates the original design with AI-assisted WS, avoiding manually keying in natural language text repeatedly. In this manner, AIASCG follows the so-called _human-in-the-loop_ (HITL) practice [51], allowing contracting parties to supervise and modify the computer-generated outputs when necessary with minimal manual efforts. A typical workflow of AIASCG is depicted in Figure 1.  
First, contracting parties from heterogeneous contexts prepare the contract clauses for negotiation in their languages, producing a human natural language (HNL) contract, whose content is a list of clauses. Then, the machine-readable contract generation will convert the HNL contract into an HML contract. Specifically, the HNL contract is first tokenized clause-by-clause. With AI-assisted WSD, a clause is automatically split into a collection of tokens called terms, the sense is predicted by the AI model from potential sense. Then, by referring to the CoDic, the terms are converted into concepts, whose definitions follow the specifications in [45; 48]. Notably, the automatic generation output of the AI-assisted generation process is only the  
Figure 1: The structure of the AIASCG framework. prediction of HNL-HML conversion, which the contracting parties can examine and adjust so that the semantic consistency between the HNL and HML contract is maintained. Finally, the HML contract will be translated into an MNL contract by case phrase generation, and the MNL contract can be translated to HNL language in different languages by the MNL translation rules so that the contracting parties in different languages can understand others' contract clauses and collaboratively revise them. The process of case phrase generation and MNL translation have been discussed in [6]. Once the final version of a contract is universally approved, its MNL form, i.e., the SSC, will be published to a blockchain for execution. The execution model is beyond the scope of this paper and has been presented in [7]. The machine-readable sentence generation and AI-assisted WS are wrapped into the _Semantic Input Method_ (SIM), which provides feedback and control flows, allowing the users to supervise the entire process. Currently, the inaugural version of SIM has been implemented in [52], and the next update is in progress to adapt to MNL specifications. Moreover, the languages supported by AIASCG depend on the vocabularies supported by CoDiC, which currently supports Chinese and English. Table 1 illustrates different representations of a smart contract produced in the AIASCG approach for a fragment of a procurement contract. Firstly, an HNL contract consists of contract clauses written in natural language, i.e., English in this example. Each clause is the execution conditions of activity for contract fulfillment. For example, the two clauses in Step 1 of Table 1 define the conditions of two activities: shipment of the contractual goods by the seller and notification of the shipment with supporting documents from the seller to the buyer. Secondly, an HML contract is produced by tokenization and conceptualization. The tokenization process segments a clause into multiple segments carrying semantic meaning. As the core component in AIASCG, a solution based on AI-assisted word segmentation model will be introduced in Section 5.