Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
863 views
in Plugins by
I'm planning to hide a freelancer to ask and answer questions. She would be paid monthly by the numbers of words she's made in  in questions', answers', and comments' contents.

How can I get a total number of words that she's created in a month?

I bet it would be a chain of SQL queries, so hopefully someone will make a suggestion.
Q2A version: 1.8.5
by
I don't know what a good metric would be (short of reviewing the actual posts). Maybe number of accepted answers? However, it should be pretty obvious to anyone that allowing a contractor to increase their payment simply by padding their posts is a bad idea. You want answers to be to the point.
by
"Points are given for activity, not for impact you made on the website."

That depends on how you implement the point system. On my site I chose an SO-like model, so merely participating won't give you points.
by
edited by
I think word stuffing can be moderated like this way. Every post made by a freelancer will be programmatically marked as "needing moderation". So as an admin, you just read and decide if a post is good or not.

But you still need "words" to quantify their works.

"allowing a contractor to increase their payment simply by padding their posts is a bad idea". I don't quite agree. The bright side of this is that a freelancer need to write useful posts with a good deal of information, instead of a one-sentence paragraph.

On one hand, you need to curb frauds, but on the other hand, you need to give them cupcakes.
by
+1
Guys, I've already implemented this stuff. Without automation, but it's just matter of time.

I have 4 freelancers posting answers. And I pay them for letters (not words) approximately 0.5$ to 1$ per 1000 letters without spaces (depending on their experience and impudence ))). Also I have 2 pages of strict guidelines, where I described every aspect of how they should answer questions.

The work they've done so far is awesome. Website shows growth every week. They are happy, I'm happy.

How am I managing word stuffing and plagiarism?

Well, first of all I have to check what they post. Then I select some answers (not all of them) and check text for uniqueness (thanks to free services) to make sure they didn't copy paste it.

It works so far. But with automation I'll be able to free more time for myself, concentrating on more important things, like finding and clustering new keywords. But this thing is also going to be delegated in future.

2 Answers

+1 vote
by
I also hired a bunch of freelances and they just copy-paste everything they post on website to word document and then send it to me for calculations. It is slow and sometimes I have to double check answers, but for now it is the only way.

But, to answer your question, I suppose you need to write an event module - https://docs.question2answer.org/plugins/modules-event/
by
+1
To be clear, as I see it, everytime a post event is triggered, your plugin will count words/letters and write numbers to DB.
by
Usually we pay employees by the hour elapsed when they work. Since freelancers are not in our office, so I believe even professional journalism is still based on pay-by-the-word rules.

It's better to set up guidelines for them to deal with plagiarism like using synonyms, resembling sentences, shuffling phrases, list items, or even change the sentence into passive voice, or how to use paraphrases properly etc. So, the ultimate goal is the same old brand new content.

Your approach to get the word count is fast, but still, it's not fraud-free. If a freelancer posts something, then delete it, then repeat doing so, then the words count will surely be manipulated.

I'm thinking of some MySQL queries to count words in a column like this:

SELECT sum(LENGTH(content)) FROM ^posts WHERE userid =# AND created BETWEEN '2020-09-01' and '2020-09-30'

Of course some single/double quotes marks, or even some HTML tags are not a big deal (or are they?).
by
+1
You have a good point there with posts manipulation, but I think it will be easy to decrease word count, when post is deleted. Didn't think about that, so thank you.

But on the other side, what is the point of doing that, because if some kind of cheating will appear this guy will loose his job straight away.

And answering your last question about tags and HTML characters - we can easily strip_tags() the post content to get raw text.
+3 votes
by
edited by

It can be done with few queries as following.

1) get array of all texts posted by THE USER between 1 month and 2 month. Lets say array name is $words. For example,

DEFINE FUNCTION SOMETHING LIKE THIS:

function get_words_array($userid,$startinterval,$endinterval)

{

$records = qa_db_read_all_assoc(qa_db_query_sub(

"SELECT content

FROM ^posts

WHERE userid = # AND (date_created BETWEEN $ AND $)",

$userid, $startinterval, $endinterval

));

return $records;

}

RUN ABOVE DEFINED FUNCTION TO GET ARRAY OF CONTENTS BY SPECIFIC USER AT SPECIFIC INTERVAL:

$words = get_words_array($userid,$startinterval,$endinterval);

2) convert array ($words) to string and merge them by foreach loop. Assign it to new variable $words_all_string

$words_all_string ='';

foreach ( $words AS $key=>$word) {

$words_all_string .= $word.' '.;

}

3) count words by 

str_word_count($words_all_string);

by
edited by
Or you can even make step 2 and 3 in ONE NEW function.

function count_words_array($array) {

$words_all_string ='';

foreach ( $array AS $key=>$arr) {
          $words_all_string .= $arr.' '.;
}

return str_word_count($words_all_string);

}
...