(1) Sometimes $text is not a string but an object of Message class. This causes exception. Code changed to handle such a case. (2) If link is made using canonical namespace anme or an alias, it is not replaced with semantic title. Fixed.
(1) Sometimes $text is not a string but an object of Message class. This causes exception. Code changed to handle such a case. (2) If link is made using canonical namespace anme or an alias, it is not replaced with semantic title. Fixed.

wikimedia/mediawiki-extensions-SemanticTitle