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.toStringtoString(36,l=9),l=9).join``+"."
Can probably be further improved. Outputs in all lowercase.
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.
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.
JavaScript (ES6), (削除) 172 (削除ここまで) (削除) 169 (削除ここまで) 157(削除) 157 (削除ここまで) 150 bytes
Saved 310 bytes thanks to @Neil
x=>x.match(/[\w'*]+|\s+/g).map(y=>y[0]==" "?y[1]:y==`
`?". ":/\*/.test(y,l=yl+=y.match(/\w/g).length)?(i=l%2||2l=l%2*10+19,""):(l+i*10+9+(i=0))l.toStringtoString(36,l=9),i=0l=9).join``+"."
Can probably be further improved. Outputs in all lowercase.
JavaScript (ES6), (削除) 172 (削除ここまで) (削除) 169 (削除ここまで) 157 bytes
Saved 3 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)?(i=l%2||2,""):(l+i*10+9+(i=0)).toString(36),i=0).join``+"."
Can probably be further improved. Outputs in all lowercase.
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.
JavaScript (ES6), (削除) 172 (削除ここまで) 169(削除) 169 (削除ここまで) 157 bytes
Saved 3 bytes thanks to @Neil
x=>x.replacematch(/([\w'*]+[\w'*]+|\s+/g)[^\w'*\s]* ?.map(y=>y[0]==" "?)[^\w\n*]*/g,(_,y,z)=>y[1]:y==`
`?". ":/\*/.test(y,l=y.match(/\w/g).length)?(i=l%2||2,""):(l+i*10+9+(i=0)).toString(36)+z,i=0).replace(/\n|$/g,"join``+".")
Can probably be further improved. Outputs in all lowercase.
JavaScript (ES6), (削除) 172 (削除ここまで) 169 bytes
Saved 3 bytes thanks to @Neil
x=>x.replace(/([\w'*]+)[^\w'*\s]* ?( ?)[^\w\n*]*/g,(_,y,z)=>/\*/.test(y,l=y.match(/\w/g).length)?(i=l%2||2,""):(l+i*10+9+(i=0)).toString(36)+z,i=0).replace(/\n|$/g,".")
Can probably be further improved. Outputs in all lowercase.
JavaScript (ES6), (削除) 172 (削除ここまで) (削除) 169 (削除ここまで) 157 bytes
Saved 3 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)?(i=l%2||2,""):(l+i*10+9+(i=0)).toString(36),i=0).join``+"."
Can probably be further improved. Outputs in all lowercase.