-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
# ======================================================================== | ||
# $File: flx.py $ | ||
# $Date: 2024-12-16 22:02:28 $ | ||
# $Revision: $ | ||
# $Creator: Jen-Chieh Shen $ | ||
# $Notice: See LICENSE.txt for modification and distribution information | ||
# Copyright © 2024 by Shen, Jen-Chieh $ | ||
# ======================================================================== | ||
|
||
def main(): | ||
"""Program Entry point. | ||
word_separators = [ ' ', '-', '_', ':', '.', '/', '\\', ] | ||
|
||
default_score = -35 | ||
|
||
def word(ch): | ||
"""Check if `ch` is a word character.""" | ||
if ch == None: | ||
return False | ||
return not ch in word_separators | ||
|
||
def capital(ch): | ||
"""Check if `ch` is an uppercase character.""" | ||
return word(ch) and ch == ch.upper() | ||
|
||
def boundary(last_ch, ch): | ||
"""Check if LAST-CHAR is the end of a word and CHAR the start of the next. | ||
This function is camel-case aware. | ||
""" | ||
if last_ch == None: | ||
return True | ||
|
||
if not capital(last_ch) and capital(ch): | ||
return True | ||
|
||
if word(last_ch) and word(ch): | ||
return True | ||
|
||
return False | ||
|
||
if __name__ == "__main__": | ||
main() | ||
def inc_vec(vec, inc, beg, end): | ||
"""Increment each element in `vec` between `beg` and `end` by `inc`.""" | ||
pass |