kandi background
Explore Kits

languagetool | Style and Grammar Checker for 25 Languages | Code Quality library

 by   languagetool-org Java Version: Current License: LGPL-2.1

 by   languagetool-org Java Version: Current License: LGPL-2.1

Download this library from

kandi X-RAY | languagetool Summary

languagetool is a Java library typically used in Code Quality applications. languagetool has no bugs, it has build file available, it has a Weak Copyleft License and it has high support. However languagetool has 1 vulnerabilities. You can download it from GitHub, Maven.
LanguageTool is an Open Source proofreading software for English, French, German, Polish, Russian, and more than 20 other languages. It finds many errors that a simple spell checker cannot detect. For more information, please see our homepage at https://languagetool.org, this README, and CHANGES. LanguageTool is freely available under the LGPL 2.1 or later.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • languagetool has a highly active ecosystem.
  • It has 6461 star(s) with 924 fork(s). There are 156 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 1495 open issues and 2858 have been closed. On average issues are closed in 60 days. There are 39 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of languagetool is current.
languagetool Support
Best in #Code Quality
Average in #Code Quality
languagetool Support
Best in #Code Quality
Average in #Code Quality

quality kandi Quality

  • languagetool has no bugs reported.
languagetool Quality
Best in #Code Quality
Average in #Code Quality
languagetool Quality
Best in #Code Quality
Average in #Code Quality

securitySecurity

  • languagetool has 1 vulnerability issues reported (0 critical, 0 high, 1 medium, 0 low).
languagetool Security
Best in #Code Quality
Average in #Code Quality
languagetool Security
Best in #Code Quality
Average in #Code Quality

license License

  • languagetool is licensed under the LGPL-2.1 License. This license is Weak Copyleft.
  • Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.
languagetool License
Best in #Code Quality
Average in #Code Quality
languagetool License
Best in #Code Quality
Average in #Code Quality

buildReuse

  • languagetool releases are not available. You will need to build from source code and install.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
languagetool Reuse
Best in #Code Quality
Average in #Code Quality
languagetool Reuse
Best in #Code Quality
Average in #Code Quality
Top functions reviewed by kandi - BETA

kandi has reviewed languagetool and discovered the below as its top functions. This is intended to give you an instant insight into languagetool implemented functionality, and help decide if they suit your requirements.

  • Get top suggestions .
  • Guess a compound tag .
  • Show configuration panel .
  • Create the GUI .
  • Get the property values from a FlatParagraph .
  • Executes the disambiguation action .
  • Initialize the components .
  • Adjusts the text according to the rules .
  • Add a paragraph error to the cache .
  • Parse the command line options .

languagetool Key Features

Jobs at LanguageTool

How to run your own LanguageTool server

HTTP API documentation

How to use our public server via HTTP

How to use LanguageTool from Java (Javadoc)

Scripted installation and building

copy iconCopydownload iconDownload
curl -L https://raw.githubusercontent.com/languagetool-org/languagetool/master/install.sh | sudo bash <options>

Alternate way to build from source

copy iconCopydownload iconDownload
git clone --depth 5 https://github.com/languagetool-org/languagetool.git

Flutter - list inside a list builder

copy iconCopydownload iconDownload
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:language_tool/language_tool.dart';

void main() => runApp(mainApp());

class mainApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Chat(),
    );
  }
}

class Chat extends StatefulWidget {
  const Chat({Key? key}) : super(key: key);

  @override
  _ChatState createState() => _ChatState();
}

class _ChatState extends State<Chat> {
  String text = 'Henlo i am Gabriele';

  static List<WritingMistake> mistakes = []; // Moved Here And Init Like Static

  Future<List<WritingMistake>> tool(String text) async {
    var tool = LanguageTool();
    var result = tool.check(text);
    var correction = await result;

    print(correction);

    for (var m in correction) {
      //var mistake = m.issueDescription;

      WritingMistake mistake = WritingMistake(
        message: m.message,
        offset: m.offset,
        length: m.length,
        issueType: m.issueType,
        issueDescription: m.issueDescription,
        replacements: m.replacements,
      );

      mistakes.add(mistake);
    }

    print(mistakes.length);
    print(mistakes);

    return mistakes;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              color: Colors.red,
              height: 150.0,
              width: double.infinity,
              child: Center(
                  child: Text(text, style: const TextStyle(fontSize: 20.0))),
            ),
            const Text(
              '\n     Tap on the blue button to replace it in the message.\n',
            ),
            FutureBuilder(
              future: tool(text),
              builder: (BuildContext context, AsyncSnapshot snapshot) {
                if (snapshot.data == null) {
                  return const Center(
                    child: Text('Loading...'),
                  );
                } else {
                  return SizedBox(
                    height: 200.0,
                    child: ListView.builder(
                      itemCount: snapshot.data.length,
                      itemBuilder: (BuildContext context, int mistakeIdIndex) {
                        return Container(
                          child: Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        Text('   ' +
                                            (mistakeIdIndex + 1).toString() +
                                            ' '),
                                        Container(
                                          child: Padding(
                                            padding: const EdgeInsets.all(8.0),
                                            child: Text(text.substring(
                                                snapshot.data[mistakeIdIndex]
                                                    .offset,
                                                snapshot.data[mistakeIdIndex]
                                                        .offset +
                                                    snapshot
                                                        .data[mistakeIdIndex]
                                                        .length)),
                                          ),
                                          color: Colors.blue,
                                        ),
                                      ],
                                    ),
                                    const Icon(
                                      Icons.arrow_forward,
                                    ),
                                    Text(snapshot
                                        .data[mistakeIdIndex].issueDescription)
                                  ],
                                ),

                                // Todo: Row with List of .replacements
                                SizedBox(
                                  width: MediaQuery.of(context)
                                      .size
                                      .width, // Width = Screen Width
                                  height: 44,
                                  child: ListView.builder(
                                      itemCount: mistakes.length,
                                      scrollDirection: Axis.horizontal,
                                      shrinkWrap: true,
                                      itemBuilder: (BuildContext context,
                                          int replacementsListIndex) {
                                        return buildReplacements(mistakeIdIndex,
                                            replacementsListIndex);
                                      }),
                                )
                              ],
                            ),
                          ),
                          // snapshot.data[index].issueDescription),
                        );
                      },
                    ),
                  );
                }
              },
            ),
            Expanded(child: Container(color: Colors.grey))
          ],
        ),
      ),
    );
  }

  Widget buildReplacements(int mistakeIdIndex, int replacementsListIndex) {
    if (mistakes[replacementsListIndex].replacements!.length == null) {
      return const SizedBox(); // Return Empty If No Replacements Found, Just To Be Safe
    }

    // Check For Mistake ID - Remove This Will Cause A Problem with Displaying All Replacements Under All Words
    if (mistakeIdIndex == replacementsListIndex) {
      // If Only 1 Replacement, No Need To Create ListView.builder
      if (mistakes[replacementsListIndex].replacements!.length == 1) {
        return Container(
          margin: const EdgeInsets.all(4),
          padding: const EdgeInsets.all(8),
          decoration: const BoxDecoration(
              color: Color.fromARGB(255, 174, 213, 130)), // Green Color
          child: Text(
            mistakes[replacementsListIndex].replacements!.toString(),
            style: const TextStyle(),
            textAlign: TextAlign.center,
          ),
        );
      } 
      // Create ListView.builder to Create A Split Between Replacements To One Wrong-Word (Every Replacement Has It's Own Container With Green Background)
      else {
        return ListView.builder(
            itemCount: mistakes[replacementsListIndex].replacements!.length,
            scrollDirection: Axis.horizontal,
            shrinkWrap: true,
            itemBuilder: (context, index) {
              return Container(
                margin: const EdgeInsets.all(4),
                padding: const EdgeInsets.all(8),
                decoration: const BoxDecoration(
                    color: Color.fromARGB(255, 174, 213, 130)), // Green Color
                child: Text(
                  mistakes[replacementsListIndex]
                      .replacements![index]!
                      .toString(),
                  style: const TextStyle(),
                  textAlign: TextAlign.center,
                ),
              );
            });
      }
    } 
    // If Replacement Not For This Wrong-Word, Then Skip
    else {
      return const SizedBox();
    }
  }
}

flutter - language_tool how to import a class

copy iconCopydownload iconDownload
WritingMistake mistake = WritingMistake(m['offset'], m['length'],
          m['issueType'], m['issueDescription'], m['replacements']);
  WritingMistake mistake = WritingMistake(message: m.message, offset: m.offset, length: m.length,
      issueType: m.issueType, issueDescription: m.issueDescription, replacements: m.replacements);
-----------------------
WritingMistake mistake = WritingMistake(m['offset'], m['length'],
          m['issueType'], m['issueDescription'], m['replacements']);
  WritingMistake mistake = WritingMistake(message: m.message, offset: m.offset, length: m.length,
      issueType: m.issueType, issueDescription: m.issueDescription, replacements: m.replacements);

Future&lt;String&gt; as text in flutter

copy iconCopydownload iconDownload
FutureBuilder<String>(
  future: tool(text),
  builder: (context, snapshot) {
    if (snapshot.hasData &&
        snapshot.connectionState == ConnectionState.done) {
      return Text(snapshot.data!);
    }

    return CircularProgressIndicator();
  },
)
-----------------------
@override
Widget build(BuildContext context) {
  return Scaffold(
    body: SafeArea(
      child: Column(
        children: [
          Text(text),
          FutureBuilder<String>(
            future: _calculation,
            builder: (BuildContext context, AsyncSnapshot<String> snapshot) =>
              Text(tool(snapshot.data)),
          ),
        ],
      ),
    ),
  );
}

Python requests and LanguageTool encoding error

copy iconCopydownload iconDownload
import requests
import json

response = requests.post(
    'https://api.languagetoolplus.com/v2/check',
    data={'text':'check for mispelling™ © 2022', 'language':'en-US'}
    )

print(json.dumps(response.json(), ensure_ascii=False, indent=2))
{
  "software": {
    "name": "LanguageTool",
    "version": "5.7-SNAPSHOT",
    "buildDate": "2022-01-18 13:50:09 +0000",
    "apiVersion": 1,
    "premium": true,
    "premiumHint": "You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.",
    "status": ""
  },
  "warnings": {
    "incompleteResults": false
  },
  "language": {
    "name": "English (US)",
    "code": "en-US",
    "detectedLanguage": {
      "name": "English (US)",
      "code": "en-US",
      "confidence": 0.924
    }
  },
  "matches": [
    {
      "message": "This sentence does not start with an uppercase letter.",
      "shortMessage": "",
      "replacements": [
        {
          "value": "Check"
        }
      ],
      "offset": 0,
      "length": 5,
      "context": {
        "text": "check for mispelling™ © 2022",
        "offset": 0,
        "length": 5
      },
      "sentence": "check for mispelling™ © 2022",
      "type": {
        "typeName": "Other"
      },
      "rule": {
        "id": "UPPERCASE_SENTENCE_START",
        "description": "Checks that a sentence starts with an uppercase letter",
        "issueType": "typographical",
        "category": {
          "id": "CASING",
          "name": "Capitalization"
        },
        "isPremium": false
      },
      "ignoreForIncompleteSentence": true,
      "contextForSureMatch": -1
    },
    {
      "message": "Possible spelling mistake found.",
      "shortMessage": "Spelling mistake",
      "replacements": [
        {
          "value": "misspelling"
        },
        {
          "value": "dispelling"
        },
        {
          "value": "mi spelling"
        }
      ],
      "offset": 10,
      "length": 10,
      "context": {
        "text": "check for mispelling™ © 2022",
        "offset": 10,
        "length": 10
      },
      "sentence": "check for mispelling™ © 2022",
      "type": {
        "typeName": "Other"
      },
      "rule": {
        "id": "MORFOLOGIK_RULE_EN_US",
        "description": "Possible spelling mistake",
        "issueType": "misspelling",
        "category": {
          "id": "TYPOS",
          "name": "Possible Typo"
        },
        "isPremium": false
      },
      "ignoreForIncompleteSentence": false,
      "contextForSureMatch": 0
    }
  ]
}
-----------------------
import requests
import json

response = requests.post(
    'https://api.languagetoolplus.com/v2/check',
    data={'text':'check for mispelling™ © 2022', 'language':'en-US'}
    )

print(json.dumps(response.json(), ensure_ascii=False, indent=2))
{
  "software": {
    "name": "LanguageTool",
    "version": "5.7-SNAPSHOT",
    "buildDate": "2022-01-18 13:50:09 +0000",
    "apiVersion": 1,
    "premium": true,
    "premiumHint": "You might be missing errors only the Premium version can find. Contact us at support<at>languagetoolplus.com.",
    "status": ""
  },
  "warnings": {
    "incompleteResults": false
  },
  "language": {
    "name": "English (US)",
    "code": "en-US",
    "detectedLanguage": {
      "name": "English (US)",
      "code": "en-US",
      "confidence": 0.924
    }
  },
  "matches": [
    {
      "message": "This sentence does not start with an uppercase letter.",
      "shortMessage": "",
      "replacements": [
        {
          "value": "Check"
        }
      ],
      "offset": 0,
      "length": 5,
      "context": {
        "text": "check for mispelling™ © 2022",
        "offset": 0,
        "length": 5
      },
      "sentence": "check for mispelling™ © 2022",
      "type": {
        "typeName": "Other"
      },
      "rule": {
        "id": "UPPERCASE_SENTENCE_START",
        "description": "Checks that a sentence starts with an uppercase letter",
        "issueType": "typographical",
        "category": {
          "id": "CASING",
          "name": "Capitalization"
        },
        "isPremium": false
      },
      "ignoreForIncompleteSentence": true,
      "contextForSureMatch": -1
    },
    {
      "message": "Possible spelling mistake found.",
      "shortMessage": "Spelling mistake",
      "replacements": [
        {
          "value": "misspelling"
        },
        {
          "value": "dispelling"
        },
        {
          "value": "mi spelling"
        }
      ],
      "offset": 10,
      "length": 10,
      "context": {
        "text": "check for mispelling™ © 2022",
        "offset": 10,
        "length": 10
      },
      "sentence": "check for mispelling™ © 2022",
      "type": {
        "typeName": "Other"
      },
      "rule": {
        "id": "MORFOLOGIK_RULE_EN_US",
        "description": "Possible spelling mistake",
        "issueType": "misspelling",
        "category": {
          "id": "TYPOS",
          "name": "Possible Typo"
        },
        "isPremium": false
      },
      "ignoreForIncompleteSentence": false,
      "contextForSureMatch": 0
    }
  ]
}

how do i apply language tool to Python df and add results as new column in df?

copy iconCopydownload iconDownload
xlreader['Description'].astype('str')
xlreader['Issues'] = xlreader['Description'].apply(lambda x: tool.check(x))
-----------------------
xlreader['Description'].astype('str')
xlreader['Issues'] = xlreader['Description'].apply(lambda x: tool.check(x))

How do I use LanguageTool API from Rapid API to check a string in Java?

copy iconCopydownload iconDownload
String x = "This is a error.";
... 
.method("POST", HttpRequest.BodyPublishers.ofString("text=" + URLEncoder.encode(x, StandardCharsets.UTF_8.toString()) +"&language=en-US")
.build();

Python &amp; Pandas: appending data to new column

copy iconCopydownload iconDownload
text_data = df["text"].fillna('')
length1 = len(text_data)
error_count_lst = []
for i, x in enumerate(range(length1)):
    errors = api.check(text_data, api_url='https://languagetool.org/api/v2/', lang='en-US')
    result = str(errors)
    error_count = result.count("message")
    error_count_lst.append(error_count)

text_data['error_count'] = error_count_lst
text_data.to_csv('file.csv', index=False)
-----------------------
df["error_count"] = df["text"].fillna("").apply(lambda x: len(api.check(x, api_url='https://languagetool.org/api/v2/', lang='en-US')["matches"]))

>>> df
   user_id  ... error_count
0       10  ...           2
1       11  ...           0
2       12  ...           0
3       13  ...           0
4       14  ...           0
5       15  ...           2
df.to_csv("Streamlit\stack.csv", index=False)
-----------------------
df["error_count"] = df["text"].fillna("").apply(lambda x: len(api.check(x, api_url='https://languagetool.org/api/v2/', lang='en-US')["matches"]))

>>> df
   user_id  ... error_count
0       10  ...           2
1       11  ...           0
2       12  ...           0
3       13  ...           0
4       14  ...           0
5       15  ...           2
df.to_csv("Streamlit\stack.csv", index=False)

How to write to file in bash without parsing?

copy iconCopydownload iconDownload
echo "$command_one$command_two" > "$LANGUAGE_TOOL_TARGET_DIR/$LANGUAGE_TOOL_CONTROL_SCRIPTNAME"

My Heroku python app needs java to be installed

copy iconCopydownload iconDownload
$ heroku buildpacks:add heroku/jvm

Community Discussions

Trending Discussions on languagetool
  • Flutter - list inside a list builder
  • flutter - language_tool how to import a class
  • Future&lt;String&gt; as text in flutter
  • Python requests and LanguageTool encoding error
  • how do i apply language tool to Python df and add results as new column in df?
  • How do I use LanguageTool API from Rapid API to check a string in Java?
  • Python &amp; Pandas: appending data to new column
  • How to write to file in bash without parsing?
  • Can not deploy Cloud Function with language_tool_python in Python 3.7 runtime
  • My Heroku python app needs java to be installed
Trending Discussions on languagetool

QUESTION

Flutter - list inside a list builder

Asked 2022-Apr-01 at 07:32

I don't have much experience with flutter.

I would like to use the language_tool library for Dart and Flutter.

I created the script below:

void main() => runApp(mainApp());

class mainApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Chat(),
    );
  }
}

class Chat extends StatefulWidget {
  const Chat({Key? key}) : super(key: key);

  @override
  _ChatState createState() => _ChatState();
}

class _ChatState extends State<Chat> {
  String text = 'Henlo i am Gabriele';

  Future<List<WritingMistake>> tool(String text) async {
    var tool = LanguageTool();
    var result = tool.check(text);
    var correction = await result;

    print(correction);

    List<WritingMistake> mistakes = [];

    for (var m in correction) {
      //var mistake = m.issueDescription;

      WritingMistake mistake = WritingMistake(
        message: m.message,
        offset: m.offset,
        length: m.length,
        issueType: m.issueType,
        issueDescription: m.issueDescription,
        replacements: m.replacements,
      );

      mistakes.add(mistake);
    }

    print(mistakes.length);
    print(mistakes);

    return mistakes;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              color: Colors.red,
              height: 150.0,
              width: double.infinity,
              child:
                  Center(child: Text(text, style: TextStyle(fontSize: 20.0))),
            ),
            Text(
              '\n     Tap on the blue button to replace it in the message.\n',
            ),
            FutureBuilder(
              future: tool(text),
              builder: (BuildContext context, AsyncSnapshot snapshot) {
                if (snapshot.data == null) {
                  return Container(
                    child: Center(
                      child: Text('Loading...'),
                    ),
                  );
                } else {
                  return SizedBox(
                    height: 200.0,
                    child: ListView.builder(
                      itemCount: snapshot.data.length,
                      itemBuilder: (BuildContext context, int index) {
                        return Container(
                          child: Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        Text('   ' +
                                            (index + 1).toString() +
                                            ' '),
                                        Container(
                                          child: Padding(
                                            padding: const EdgeInsets.all(8.0),
                                            child: Text(text.substring(
                                                snapshot.data[index].offset,
                                                snapshot.data[index].offset +
                                                    snapshot
                                                        .data[index].length)),
                                          ),
                                          color: Colors.blue,
                                        ),
                                      ],
                                    ),
                                    Icon(
                                      Icons.arrow_forward,
                                    ),
                                    Text(snapshot.data[index].issueDescription)
                                  ],
                                ),

                                // Todo: Row with List of .replacements
                              ],
                            ),
                          ),
                          // snapshot.data[index].issueDescription),
                        );
                      },
                    ),
                  );
                }
              },
            ),
            Expanded(child: Container(color: Colors.grey))
          ],
        ),
      ),
    );
  }
}

And it currently looks like this:

enter image description here

And I would like it to become like in this screen, but I would like the green containers derive from the WritingMistake.replacements list (with each element of the list as text):

enter image description here

Do you know how I can do it?

ANSWER

Answered 2022-Apr-01 at 00:14

Spent several hours doing exactly what you wanted. My Code:

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:language_tool/language_tool.dart';

void main() => runApp(mainApp());

class mainApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Chat(),
    );
  }
}

class Chat extends StatefulWidget {
  const Chat({Key? key}) : super(key: key);

  @override
  _ChatState createState() => _ChatState();
}

class _ChatState extends State<Chat> {
  String text = 'Henlo i am Gabriele';

  static List<WritingMistake> mistakes = []; // Moved Here And Init Like Static

  Future<List<WritingMistake>> tool(String text) async {
    var tool = LanguageTool();
    var result = tool.check(text);
    var correction = await result;

    print(correction);

    for (var m in correction) {
      //var mistake = m.issueDescription;

      WritingMistake mistake = WritingMistake(
        message: m.message,
        offset: m.offset,
        length: m.length,
        issueType: m.issueType,
        issueDescription: m.issueDescription,
        replacements: m.replacements,
      );

      mistakes.add(mistake);
    }

    print(mistakes.length);
    print(mistakes);

    return mistakes;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              color: Colors.red,
              height: 150.0,
              width: double.infinity,
              child: Center(
                  child: Text(text, style: const TextStyle(fontSize: 20.0))),
            ),
            const Text(
              '\n     Tap on the blue button to replace it in the message.\n',
            ),
            FutureBuilder(
              future: tool(text),
              builder: (BuildContext context, AsyncSnapshot snapshot) {
                if (snapshot.data == null) {
                  return const Center(
                    child: Text('Loading...'),
                  );
                } else {
                  return SizedBox(
                    height: 200.0,
                    child: ListView.builder(
                      itemCount: snapshot.data.length,
                      itemBuilder: (BuildContext context, int mistakeIdIndex) {
                        return Container(
                          child: Padding(
                            padding: const EdgeInsets.all(8.0),
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.start,
                                      children: [
                                        Text('   ' +
                                            (mistakeIdIndex + 1).toString() +
                                            ' '),
                                        Container(
                                          child: Padding(
                                            padding: const EdgeInsets.all(8.0),
                                            child: Text(text.substring(
                                                snapshot.data[mistakeIdIndex]
                                                    .offset,
                                                snapshot.data[mistakeIdIndex]
                                                        .offset +
                                                    snapshot
                                                        .data[mistakeIdIndex]
                                                        .length)),
                                          ),
                                          color: Colors.blue,
                                        ),
                                      ],
                                    ),
                                    const Icon(
                                      Icons.arrow_forward,
                                    ),
                                    Text(snapshot
                                        .data[mistakeIdIndex].issueDescription)
                                  ],
                                ),

                                // Todo: Row with List of .replacements
                                SizedBox(
                                  width: MediaQuery.of(context)
                                      .size
                                      .width, // Width = Screen Width
                                  height: 44,
                                  child: ListView.builder(
                                      itemCount: mistakes.length,
                                      scrollDirection: Axis.horizontal,
                                      shrinkWrap: true,
                                      itemBuilder: (BuildContext context,
                                          int replacementsListIndex) {
                                        return buildReplacements(mistakeIdIndex,
                                            replacementsListIndex);
                                      }),
                                )
                              ],
                            ),
                          ),
                          // snapshot.data[index].issueDescription),
                        );
                      },
                    ),
                  );
                }
              },
            ),
            Expanded(child: Container(color: Colors.grey))
          ],
        ),
      ),
    );
  }

  Widget buildReplacements(int mistakeIdIndex, int replacementsListIndex) {
    if (mistakes[replacementsListIndex].replacements!.length == null) {
      return const SizedBox(); // Return Empty If No Replacements Found, Just To Be Safe
    }

    // Check For Mistake ID - Remove This Will Cause A Problem with Displaying All Replacements Under All Words
    if (mistakeIdIndex == replacementsListIndex) {
      // If Only 1 Replacement, No Need To Create ListView.builder
      if (mistakes[replacementsListIndex].replacements!.length == 1) {
        return Container(
          margin: const EdgeInsets.all(4),
          padding: const EdgeInsets.all(8),
          decoration: const BoxDecoration(
              color: Color.fromARGB(255, 174, 213, 130)), // Green Color
          child: Text(
            mistakes[replacementsListIndex].replacements!.toString(),
            style: const TextStyle(),
            textAlign: TextAlign.center,
          ),
        );
      } 
      // Create ListView.builder to Create A Split Between Replacements To One Wrong-Word (Every Replacement Has It's Own Container With Green Background)
      else {
        return ListView.builder(
            itemCount: mistakes[replacementsListIndex].replacements!.length,
            scrollDirection: Axis.horizontal,
            shrinkWrap: true,
            itemBuilder: (context, index) {
              return Container(
                margin: const EdgeInsets.all(4),
                padding: const EdgeInsets.all(8),
                decoration: const BoxDecoration(
                    color: Color.fromARGB(255, 174, 213, 130)), // Green Color
                child: Text(
                  mistakes[replacementsListIndex]
                      .replacements![index]!
                      .toString(),
                  style: const TextStyle(),
                  textAlign: TextAlign.center,
                ),
              );
            });
      }
    } 
    // If Replacement Not For This Wrong-Word, Then Skip
    else {
      return const SizedBox();
    }
  }
}

And Screenshot:

enter image description here

Source https://stackoverflow.com/questions/71698897

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

Cross-site scripting (XSS) vulnerability in the embedded webserver in Daniel Naber LanguageTool before 0.8.9 allows remote attackers to inject arbitrary web script or HTML via unspecified vectors involving an error message, possibly the demultiplex method in HTTPServer.java.

Install languagetool

To install or build using a script, simply type:.

Support

The development overview describes how you can contribute error detection rules. See 'easy fix' issues for issues to get started. For more technical details, see our dev pages.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Code Quality Kits
Compare Code Quality Libraries with Highest Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.