# RunsGuard Framework: Context Aware Cricket Game Strategy for Field Placement and Score Containment
## 3 Proposed Framework for Cricket Game Strategy and Field Placement Optimization
### Information Extractor  
In this step, valuable features are extracted from the preprocessed text commentary. Figure 2 illustrates the procedure. The commentary data we utilized is a detailed textual representation of the live ball-by-ball activity during a cricket match. These data do not reflect the commentator's personal opinions but rather provide a factual account of events as they unfold in the field. Our data extraction process is designed to parse this textual information to retrieve only objective data points that are crucial for our analysis, such as the bowler's name, batsman, outcome of the delivery, delivery length, delivery line, shot placement, and shot type. Figure 2: Demonstration of Feature Extraction from Text Commentary. We used the NLP spaCy library for its powerful NLP capabilities to tokenize textual expressions. This library enabled us to identify key features of speech, such as part-of-speech tags and word embeddings, which are important for our in-depth analysis. This enables us to systematically classify text commentary into predefined features, such as Delivery Line, Delivery Length, Bowler, Batsman, outcome shot type, and others, to understand the game's dynamics. Owing to its concise and somewhat structured format, a cricket commentary is easier to analyze than unstructured text. The conditional Random Field (CRF) model was used to predict game-specific labels using the sklearn-crfsuite. We opted to use CRF simply because it is good in understanding word sequences and context, which form the biggest chunk in reading cricket commentary. The CRF model is trained with expert-checked commentary and is made sure that the model learns and can correctly identify the key elements of the game, the actions players take, and the results of these actions. We fine-tuned the CRF model settings after training to obtain the most accurate results. The extracted attributes serve as the foundation for initiating an in-depth analysis of player performance in the next step. A detailed breakdown of this process is presented in Algorithm 2. ```
1 Input: Text commentary dataset \(X=\{x_{1},x_{2},x_{3},\ldots,x_{n}\}\) where xi represents the textual commentary instances. 2 Output: Sequences of features of each commentary \(Y=\{y_{1},y_{2},y_{3},\ldots,y_{n}\}\) where \(y_{i}\) is a sequence of features corresponding to \(x_{i}\). 3 Processing: 1. [label=()]
2. Tokenize the commentary. 2. Extract linguistic features (POS tags, word embeddings). 3. Define feature categories (Delivery Line, Length, Speed, Field Position, Shot Type, etc.). 4. Generate labeled training data with token-level labels. 5. Train a Conditional Random Field (CRF) model. \[\mathrm{P}(\gamma|X)=\frac{1}{Z(X)}\exp\left(\sum_{i=1}^{N}\sum_{j=1}^{L}( \lambda_{j}f_{j}(y_{i},y_{i-1},X,i))\right)\] (1) where: * \(P(Y|X)\) is conditional probability. * \(Z(X)\) is a normalization factor. * \(\lambda_{j}\) model parameters that assign weights to the feature functions. * \(f_{j}(y_{i},y_{i-1},X,i)\) refers to characteristic functions evaluating label alignment with input order. * The trained CRF model extracts features and tags sequences in new commentary. (f) Evaluate the model using validation data. 4 Inference Phase: 1. [label=()]
5. For all new commentary data: 2. Tokenize the commentary text. 3. Extract linguistic features. 4. Predict the labels for each token using the trained CRF model, as shown in Equation (1). 5. Map labels to corresponding feature categories. 6. Store extracted features for each delivery. ### Analyzer Unveiling Player's Strengths and Weaknesses

By analyzing the feature distributions, this step uncovers distinctive trends and patterns that provide insights into a player's strengths and weaknesses across various dimensions of the game. The comprehensive process is provided in Algorithm 3 and illustrated in Figure 3.
```
1 Input: Feature Data (FeatureDataSet) \(X=\{x_{1},x_{2},x_{3},\dots,x_{n}\}\) where xi represents the features extracted in the previous step from commentary ball-by-ball data.