[Question]
  [
# Decipher Neurotic Frogs
Now that Puzzling.SE has finally cracked [my amphibian-obsessed cipher](https://puzzling.stackexchange.com/q/31212/21402), let's write a program or function to decrypt it!
**(If you want to look at the puzzle before having it spoiled for you, click the above link now.)**
---
### How the cipher works
In Neurotic Frogs *O*ught To Rel*a*x In *M*ud Baths ("Neurotic Frogs" for short), every letter is encrypted as one or two words:
* The length of a non-italicized word represents a letter.
	+ `neurotic` => 8 letters => `H`
	+ `frogs` => 5 letters => `E`
	+ `perpendicular` => 13 letters = `M`
* A word that contains italics modifies the following word, adding 10 if the italicized word was odd in length or 20 if the italicized word was even in length. Any or all of the word may be italicized. An italicized word is always followed by a non-italicized word.
	+ `*o*ught to` => odd, 2 => 12 => `L`
	+ `lo*u*nging calms` => even, 5 => 25 => `Y`
Every word of plaintext corresponds to a sentence of ciphertext, and every sentence of plaintext corresponds to a paragraph of ciphertext.
### Input format
Your program or function shall input a message in Neurotic Frogs, formatted in Markdown. The input will consist only of printable ASCII and newlines.
* *Words* are runs of characters that match the regex `[A-Za-z0-9']`.
	+ Numbers and letters both count toward the length of a word. `QB64` represents `D`.
	+ NOTE: Apostrophes *do not count* toward the length of a word. `Isn't` represents `D`, not `E`.
* *Italicized letters* are wrapped in a pair of asterisks (`*letters*`).
	+ One or more consecutive letters may be italicized, up to an entire word (`masseus*es*`, `*all*`); multiple non-consecutive letters in a word may also be italicized (`g*e*n*e*rates`).
	+ Italics never span multiple words, never include punctuation, and never include apostrophes.
	+ Unpaired asterisks and multiple adjacent asterisks will never occur.
* *Punctuation* is any of the following characters: `.,?!:;-()"`.
	+ Words within a sentence are separated by one or more punctuation characters *and/or* a single space. Examples: `*all* welcomed`, `toad*s*, newts`, `Ever*y*one--frogs`, `cap... bliss`, `they're (I`
	+ Sentences end with one or more punctuation characters and are separated by a double space: `Th*e* Montgomery A*m*phibian Salon! Come luxuriate today!`
	+ Paragraphs are separated by a single newline. (The last sentence of a paragraph still has one or more punctuation characters at the end.)
Other characters will not appear in input and do not need to be handled.
Your code may, at your discretion, expect input to have a single trailing newline.
### Output format
The result of decrypting the input will be one or more sentences. Letters of plaintext may be any combination of upper- and lowercase. Words within a sentence must be separated by single spaces. Sentences must end with a period (`.`) and be separated by a single space. You may output a trailing space after the last sentence. Your output will all be on one line, but you may output a trailing newline.
### Miscellaneous details
Your code may use any of the standard input and output methods. It must receive input as a multiline string, not a list or other data structure, and it must output a string.
The shortest code in bytes wins!
### Test cases
```
-->
Neurotic Frogs *O*ught To Rel*a*x In *M*ud Baths!
<--
HELLO.
-->
Business standards all*o*w only *adult* amphibians.
<--
HINT.
-->
Rejoice, *a*ll frogs an*d* toads also!  Montgomery Sal*o*n opens up!  Ha*pp*y throng fill*s* street ecstatically!
<--
GOOD JOB PPL.
-->
I like 3.1415926535897.
IM*O*, it's a *b*la*st*, yeah!
<--
ADAM. MAN.
-->
*I*, happily, *th*anks 2 u *e*ditin*g* specific wor*ding*--clarifying a *bit*--betterment :D!
<--
QUARTATA.
-->
Perpendicular l*ou*nging calms.  *A* frog, a m*u*d cap... bliss!  Wallowing g*e*n*e*rates happiness.  Amphibian sp*a* isn't expensive--seventy d*o*llars--cheap!  That'*s* not *a* large e*x*pens*e* from an*y* discerning fr*o*g's money, unlik*e* Super 8.
Ever*y*one--frogs, toad*s*, newts, *a*nd salamanders!  G*e*t a wonderful shiat*s*u, or recei*v*e an other kind.  Masseus*es* are her*e* today!  Invite a fianc*e*e, supervisor, roommate, niece: *all* welcomed!
Y*o*u simply ne*v*er believed these p*o*ssibilitie*s*; they're (I *swear*) absolute truth!  Th*e* Montgomery A*m*phibian Salon!  Come luxuriate today!
<--
MY NAME IS INIGO MONTOYA. YOU KILLED MY FATHER. PREPARE TO DIE.
```
  
[Answer]
# Perl, 72 bytes
```
#!perl -n
$x=/\*/?2-y/'//c%2:!print/ /?$':chr$x.0+y/'//c+64for/[\w*']+|  /g,' . '
```
Counting the shebang as one, input is taken from stdin.
**Sample Usage**
```
$ more in.dat
Neurotic Frogs *O*ught To Rel*a*x In *M*ud Baths!
Perpendicular l*ou*nging calms.  *A* frog, a m*u*d cap... bliss!  Wallowing g*e*n*e*rates happiness.  Amphibian sp*a* isn't expensive--seventy d*o*llars--cheap!  That'*s* not *a* large e*x*pens*e* from an*y* discerning fr*o*g's money, unlik*e* Super 8.
Ever*y*one--frogs, toad*s*, newts, *a*nd salamanders!  G*e*t a wonderful shiat*s*u, or recei*v*e an other kind.  Masseus*es* are her*e* today!  Invite a fianc*e*e, supervisor, roommate, niece: *all* welcomed!
Y*o*u simply ne*v*er believed these p*o*ssibilitie*s*; they're (I *swear*) absolute truth!  Th*e* Montgomery A*m*phibian Salon!  Come luxuriate today!
$ perl neurotic-frogs.pl < in.dat
HELLO. MY NAME IS INIGO MONTOYA. YOU KILLED MY FATHER. PREPARE TO DIE.
```
[Answer]
# JavaScript (ES6), ~~172~~ ~~169~~ ~~157~~ 150 bytes
*Saved 10 bytes thanks to @Neil*
```
x=>x.match(/[\w'*]+|\s+/g).map(y=>y[0]==" "?y[1]:y==`
`?". ":/\*/.test(y,l+=y.match(/\w/g).length)?(l=l%2*10+19,""):l.toString(36,l=9),l=9).join``+"."
```
Can probably be further improved. Outputs in all lowercase.
[Answer]
# [Pip](http://github.com/dloscutoff/pip), ~~65~~ 64 bytes
The score is 62 bytes of code + 2 for the `-rs` flags.
```
Flg{O{{(zy*t+#a-1)X!Y'*Na&2-#a%2}MJa@`[\w*]+`}MlRM''^sX2O". "}
```
[Try it online!](https://tio.run/##FY5NT8JAEIbv/ooBotWBNpGTR/FAoknBIIkYP8LSDtuN293NzhaohN9et4c5vfM@7@OU67q5lufl@Xz712IYj0R6f7cZfCS4EDfTdCSup5f8RTxuP7@O@D3eXnK9ypPkhzfT5TCD4aXrFtR4G1QBc28lAy6xkVWAtYUVaRR4gmcDmGNTwpMIFQ@uXsk7MqUqGi08aLQNGqmMhELomjMAnCHsI20CAmpssIyJy7IMdloxDwDehdb22FckEpp4XgRiqIRzyhD3kFntKrVTwgC7qAGKTRKATnGa1YHSlOlAJrRQokUdTThNi4qEi/x1JUKCjGBsgL4cY0lAeMK@Hvd6vxqEwRahVFyQN73O3keYTBhqa6idQGO0@u3f3xpHHh6yLvX8Dw)
### Explanation
The `-r` flag reads all lines of stdin and stores a list of them in `g`. The `-s` flag sets the output format of lists to space-separated.
The easiest way to read this code is from the outside in:
```
Flg{...}                   For each line l in g, do:
O{...}MlRM''^sX2O". "      Translate a paragraph into a sentence of plaintext:
       lRM''               Remove apostrophe characters
            ^sX2           Split on "  " into sentences
 {...}M                    Map the below function to each sentence
O                          Output the result list, space-separated, without newline
                O". "      Output that string, without newline
{...}MJa@`[\w*]+`          Translate a sentence into a word of plaintext:
       a@`[\w*]+`          Find all matches of regex (runs of alphanumeric and *)
{...}MJ                    Map the below function to each word and join into string
(zy*t+#a-1)X!Y'*Na&2-#a%2  Translate a word into a letter of plaintext:
      #a-1                 Length of word minus 1
  y*t+                     Add 10 or 20 if y is set (see below)
(z        )                Use that number to index into lowercase alphabet
              '*Na&        Count * characters in word, logical AND with...
                   2-#a%2  2 if word is even length, 1 if odd
             Y             Yank that value into y, to modify the following word
           X!              String multiply the character by not(y)
                           If y is truthy, the word had italics, and we get ""
                           If y is falsy, the word had no italics, and we get a letter
```
[Answer]
# Python 2, ~~238~~ ~~221~~ ~~218~~ ~~214~~ ~~207~~ 205 bytes
```
from re import*
def f(x):
 d='';m=0
 for w in split(r"[^\w\d*'~\n]+",sub('  ','~',x))[:-1]:l=len(sub("[*'~\n]",'',w));q='*'in w;d+='. '[w[0]>'}':]*(w[0]in'~\n')+chr(64+l+m)[q:];m=(2-l%2)*10*q
 print d+'.'
```
Uses lots of regex to do the processing. We transform the double-space into `~` and use that to process it. `~` and `\n` are handled specially.
The biggest character gain comes from the preprocessing of the input in the `for` line; this can definitely be golfed further.
[Ideone it!](http://ideone.com/o1Fni1) (all test cases)
*Saved 7 bytes thanks to DLosc!*
[Answer]
# Python 2.7, ~~390~~ ~~342~~ ~~341~~ ~~339~~ 335 bytes:
```
from re import*
def F(i):
 W=X="";S,s=split,sub;D='[^\w\s*]';Q=lambda c,t:len(s(D,X,c.group()).split()[t])
 for m in S('\W\n',s(D+"*\w*\*\w+\*.*?(?=\s) \w+",lambda v:"a"*([20,10][Q(v,0)%2]+Q(v,1)),s("'",X,s("--"," ",i)))):
  for g in S('\W  ',m):
   for q in S('\W',g):
    W+=chr(64+len(q))
   W+=" "
  W=W[:-1]+". "
 print s("@",X,W)
```
Takes input in the format: 
`F('''Multi or Single-lined String''')`
Can be golfed down a lot more, which I will do whenever I get the chance.
[Repl.it with All Test Cases!](https://repl.it/D4Cp/46)
## Explanation:
Uses the immense power of Python's regular expression built-ins to decipher the input. This is the fundamental process the function goes through for each input:
1. Firstly, all `--` are replaced with a single space, and every apostrophe is removed. Then, all words containing italicized components and the word proceeding it are both matched in one string and replaced with `10 + len(second word)` number of consecutive `a`s if the length of the first word is `odd`, and `20 + len(second word)` consecutive `a`s otherwise. This makes use of the following regular expression:
`[^\w\s*]*\w*\*\w+\*.*?(?=\s) \w+` 
For example, if we have the sentence `Perpendicular l*ou*nging calms.`, `l*ou*nging calms` will be replaced with `aaaaaaaaaaaaaaaaaaaaaaaaa`, or 25 `a`s, since `l*ou*nging` has an even number of characters and `calms` has 5. `20+5=25`.
2. Now, the newly modified input is split at each punctuation mark followed by a newline (`\n`) to get the paragraphs, then each paragraph is split at each punctuation followed by 2 spaces to get the sentences, and finally, each sentence is split into words along any punctuation including a space. Then, for each word (including the runs of consecutive `a`s), we add on to a string `W` the letter corresponding to the unicode code point `64` (the unicode code point of the character before `A`, which is `@`) plus `len(word)`. We then add a single space to `W` once all the words of a sentence have been exhausted, and when all the sentences in a paragraph are exhausted, we add a `.` followed by a single space.
3. Finally, after the entire input has been gone through, `W` is output to `stdout` as the deciphered message.
[Answer]
# PHP, 196 Bytes
```
<?preg_match_all("#[\w*']+|  |$#m",$_GET[s],$m);foreach($m[0]as$s){if(!$s||$s=="  ")echo!$s?". ":" ";else{$l=$p+64+strlen(str_replace("'","",$s));if(!$p=strstr($s,"*")?20-$l%2*10:0)echo chr($l);}}
```
If I could assume that there is only one Apostrophe in the middle of a word 194 Bytes
```
<?preg_match_all("#[\w*]+(<?=')[\w*]+|[\w*]+|  |$#m",$_GET[s],$m);foreach($m[0]as$s){if(!$s||$s=="  ")echo!$s?". ":" ";else{$l=$p+64+strlen($s);if(!$p=strstr($s,"*")?20-$l%2*10:0)echo chr($l);}}
```
[Answer]
# PHP, ~~231~~ ~~226~~ 228 bytes
for a start
```
<?preg_match_all("#([\w\*']+)([^\w\*']*)#",$argv[1],$m,2);foreach($m as list(,$a,$b)){$e=strlen(strtr($a,["'"=>""]))+$d;if(!$d=strstr($a,'*')?$e%2*10:0)echo chr($e+64),strpos(".$b","
")?". ":(strpos(".$b","  ")?" ":"");}echo".";
```
Save to file, rund `php <scriptpath> <text>`. Escape newlines in the text to make it work in shell.
]