Code Monkey home page Code Monkey logo

grammark's Introduction

Grammark

A complete web application for identifying writing problems and offering suggestions.

Requirements

To run Grammark, you need to have a browser with Javascript enabled (almost all do by default).

Build Architecture

Out-of-Box Installation

If you just want your own version of Grammark on your server, head on over to https://github.com/markfullmer/grammark/tree/angular-distribution. Clone the files, or download the zip into a directory on your server.

You should now have a fully-functional grammar checker!

Developer Installation

  1. Clone the main branch of this repository:
git clone [email protected]:markfullmer/grammark.git .
  1. Grammark is built on the yeoman angular scaffolding To facilitate easy development, install yo, grunt-cli, bower, generator-angular and generator-karma:
npm install && bower install

You can then use the following for local development:

Serve the project locally

grunt serve

Build the distribution

grunt build

License

This software is protected under the GNU General Public License You may use it, provided that any modifications you make to it are available for others to use and modify in a similar manner.

Versions

Release Short Description
Grammark Angular (developers) yeoman-Angular build for developers
Grammark Distribution (non-developers) CDN-ified AngularJS out-of-the-box app
Grammark No-SQL Does not require SQL database to run; data stored in filesystem
Grammark 3.0 Twig templating and class-based PHP
Grammark 2.0 Foundation-based CSS with better directory structure and settings files
Grammark 1.0 Custom CSS with flat file structure

grammark's People

Contributors

markfullmer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grammark's Issues

Grammatical Error

Bad correction of "on going" to ongoing:

Example Input
"Mark insisted on going and earning 3 dollars."

Grammatical Recommendation by Grammark:
Mark insisted ongoing and earning 3 dollars.

cut and paste into word

Hi,

I love this program for editing that you have set up. I am showing this to students that I tutor who have learning differences.

I find that after we paste some text and make corrections, we are unable to copy and paste the improved version back into word (on a PC) without encountering formatting problems. Once in the word document, any formatting changes (i.e. indent a paragraph) result in weird overall formatting changes that cannot be removed.

Expanding Grammark's Functionality

Hi Mark,

I have been working upon your grammark checker and have been trying to expand its features. However, I have been having some difficulty in fully understanding your code especially how you tried to clean up raw text input and analyze it. Below is a sample.

parse : function (rawText) { var withLineBreaks, simpleQuotes, noSuggestions, placeholder; withLineBreaks = rawText.replace(/<br(.*?)>/g, 'LINEBREAK'); withLineBreaks = withLineBreaks.replace(/<p(.*?)>/gi, 'PARAGRAPHSTART'); simpleQuotes = withLineBreaks.replace(/[\u2018\u2019]/g, "'").replace(/[\u201C\u201D]/g, '"'); noSuggestions = String(simpleQuotes).replace(/<span class="suggestion">(.*?)<\/span>/gi, ''); this.sanitized = String(noSuggestions).replace(/<[^>]+>/gm, ''); this.noLineBreaks = this.sanitized.replace(/PARAGRAPHEND/g, ' '); this.noLineBreaks = this.noLineBreaks.replace(/PARAGRAPHSTART/g, ' '); this.noLineBreaks = this.noLineBreaks.replace(/LINEBREAK/g, ' '); placeholder = this.noLineBreaks.replace(/[\-\/#!\"$%\^&\*:{}=\-_~()]/g, '');
this.spacedPunctuation = placeholder.replace(/[.,;]/g, ' .');
this.semicolonsAndPeriods = this.noLineBreaks.replace(/[,-/#!"$%^&*:{}=-_~()]/g, ''); this.sentences = this.semicolonsAndPeriods.replace(/[?;]/g, '.'); this.sentenceCount = this.sentences.trim().split(/[\.]/g).length - 1; this.noPunctuation = ' ' + this.sentences.replace(/[\.]/g, '').toLowerCase() + ' '; this.words = this.noPunctuation.trim().split(/\s+/); this.wordCount = this.words.length; },
...
highlight: function (analysisType) { // todo -- what about getting the latest text? var i, match, suggestion, uppercase; this.highlighted = this.sanitized; this.highlighted = this.highlighted.split('LINEBREAK').join('<br>'); this.highlighted = this.highlighted.split('PARAGRAPHSTART').join('<br><br>'); this.highlighted = this.highlighted.replace(/\n{2}/g, ' </p><p>'); this.highlighted = this.highlighted.replace(/\n/g, ' <br />'); this.highlighted = this.highlighted.replace(/\n/g, ' <br />'); this.highlighted = this.highlighted.replace('&nbsp;', ' '); type.get(analysisType); i = 0; for (i = 0; i < this.matches.length; i++) { match = this.matches[i]; suggestion = ''; if (type.data.corrections[match] !== undefined) { suggestion = '<span class="suggestion">' + type.data.corrections[match] + '</span>'; } this.highlighted = this.highlighted.split(' ' + match + ' ').join(' <mark>' + suggestion + match + '</mark> '); this.highlighted = this.highlighted.split(' ' + match + '.').join(' <mark>' + suggestion + match + '</mark>.'); this.highlighted = this.highlighted.split(' ' + match + ',').join(' <mark>' + suggestion + match + '</mark>,'); this.highlighted = this.highlighted.split(' ' + match + ';').join(' <mark>' + suggestion + match + '</mark>;'); this.highlighted = this.highlighted.split('"' + match + ',').join('"<mark>' + suggestion + match + '</mark>,'); this.highlighted = this.highlighted.split('"' + match + '"').join('"<mark>' + suggestion + match + '</mark>"'); this.highlighted = this.highlighted.split('<br>' + match + ' ').join('<br><mark>' + suggestion + match + '</mark> '); uppercase = match.substr(0, 1).toUpperCase() + match.substr(1); this.highlighted = this.highlighted.split(' ' + uppercase + ' ').join(' <mark>' + suggestion + uppercase + '</mark> '); this.highlighted = this.highlighted.split(' ' + uppercase + '.').join(' <mark>' + suggestion + uppercase + '</mark>.'); this.highlighted = this.highlighted.split(' ' + uppercase + ',').join(' <mark>' + suggestion + uppercase + '</mark>,'); this.highlighted = this.highlighted.split(' ' + uppercase + ';').join(' <mark>' + suggestion + uppercase + '</mark>;'); this.highlighted = this.highlighted.split('"' + uppercase + ',').join('"<mark>' + suggestion + uppercase + '</mark>,'); this.highlighted = this.highlighted.split('"' + uppercase + '"').join('"<mark>' + suggestion + uppercase + '</mark>"'); this.highlighted = this.highlighted.split('<br>' + uppercase + ' ').join('<br><mark>' + suggestion + uppercase + '</mark> '); }

So far, I have successfully made it catch double-negatives and others.

I will be very glad if you can help me out as a professional coder. Forgive me if I sound really stupid but I am just a amateur coder.

Separate library

Hi. This looks great. Thanks for releasing this open source.

Do you have a single library available to just do the grammar checking (without the user interface or database backend?). Then it could easily be included in other projects that already have their own front and back ends eg I'd add this to a simple content management system that uses markdown for formatting...

(ps. sorry if you have this already: i hunted around for a wee bit but did not see it immediately)

Running Grammark V3.0 in a Sub-directory

Thanks for Grammark!

I like it so much that I installed v.3.0 on localhost (port 4001) in the folder grammark. I got the database imported with no problems and it ran. But, clicking on the tabs took me to the wrong URLs. I took a wild stab and edited settings.php by setting the host as:
define('HOST','localhost:4001/grammark/'); // usually localhost

That didn't work...

SOLUTION

I got it to work using the following.

In the settings.php, I have:
define('HOST','localhost');

In index.php, I changed $content:
$content['url'] = "http://" . $_SERVER['SERVER_NAME'] . ":4001/grammark/";

In index.twig, I added {{ url }}:

<ul id="tabnav">
        <li class="tab1"><a href="{{ url }}">Overview</a></li>
        <li class="tab2"><a href="{{ url }}index.php?id=passive">Passive Voice</a></li>
        <li class="tab3"><a href="{{ url }}index.php?id=wordiness">Wordiness</a></li>
        <li class="tab4"><a href="{{ url }}index.php?id=transitions">Transitions</a></li>
        <li class="tab5"><a href="{{ url }}index.php?id=andbutor">Sentences</a></li>
        <li class="tab6"><a href="{{ url }}index.php?id=grammar">Grammar</a></li>
        <li class="tab6"><a href="{{ url }}index.php?id=nominalizations">Nominalizations</a></li>
        <li class="tab7"><a href="{{ url }}index.php?id=academic">Academic Style</a></li>
        <li class="tab8 right"><a href="{{ url }}index.php?id=start">Reset and Start Over</a></li>
 </ul>

In results.twig, I added the {{ url }} to the buttons:

<a class="button" href="{{ url }}index.php?id=passive">Fix Problems</a>
<a class="button" href="{{ url }}index.php?id=start">Start Over</a><br />

Oh, don't forget to delete all the files in the cache folder.

I'm not a programmer. While this works, I was just wondering if there was an easier way to set a universal path for an installation in a sub-directory.

Thanks!

Eggcorns bug?

Hello! Grammark is a great online tool.
However, Eggcorns doesn't handle words with "-".

Examples:
curly roads curvy roads
handy-downs hand-me-downs
old timers disease Alzheimer's disease
old-timers disease Alzheimer's disease

Thank you!

Grammar Check Incorrect

I notice that, when submitting text to check with deliberate spelling mistakes and grammar errors, the script does not pick up any (or only a few) grammar mistakes. With the 'vintage' version of this script, the spelling errors are at least caught.

Bug (?) in sentence length computation

Hello,

I think there is an error in the sentence length checker.
In the process(...) function you call the type.data.process(...) function with the this.spacedPunctuation parameter.

var result = type.data.process(this.spacedPunctuation);

In the sentences function this is used in getSentences(...) to retrieve text split sentence wise.

var sentences = getSentences(rawText);

The problem is (potentially) the following line:

this.spacedPunctuation = placeholder.replace(/[\.,;]/g,' .');

here you replace ',' by '.'

That means you count only the sentence length of subphrases or subsentences. Or is this intended behavior?

Passive voice results

After running text through the new grammark, and correcting passive errors, the vintage grammark catches additional passive errors not caught by the new grammark. Is this an error, or is this to be expected? This question is an example of the issue. You can copy and paste this into both and see that the vintage version catches more.

Batch utility

dear Mr. Fullmer,
would it be possible to use grammark as a batch utility placing a symbol (for example an asterisk) at every location where a grammatical error or imperfection has been spotted in a text? Or maybe a code indicating the type of error/imperfection?
I would like to apply grammark to a large corpus of texts and this excludes the interactive approach.
Thank you very very much in advance,
Yannis Haralambous

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.