def detect_pattern_format(pattern_filename, encoding, on_word_boundaries):
tsv = True<EOL>boundaries = on_word_boundaries<EOL>with open_file(pattern_filename) as input_file:<EOL><INDENT>for line in input_file:<EOL><INDENT>line = line.decode(encoding)<EOL>if line.count('<STR_LIT:\t>') != <NUM_LIT:1>:<EOL><INDENT>tsv = False<EOL><DEDENT>if '<STR_LIT>' in line:<EOL><INDENT>boundaries = True<EOL><DEDENT>if boundaries and not tsv:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>return tsv, boundaries<EOL>
Automatically detects the pattern file format, and determines
whether the Aho-Corasick string matching should pay attention to
word boundaries or not.

Arguments:
- `pattern_filename`:
- `encoding`:
- `on_word_boundaries`: