-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
b30a4e7
commit 345c37b
Showing
9 changed files
with
99 additions
and
2 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 |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
|
||
|
||
from .cnyeardb_obj import Cnyeardb | ||
from .cnyear_obj import Cnyear | ||
|
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Structure | ||
|
||
*learned from kennethreitz/samplemod* | ||
|
||
Floder | ||
docs | ||
[docs] | ||
sample | ||
[scripts] | ||
tests | ||
[testunits] | ||
.gitignore | ||
LICENSE | ||
MANIFEST.in | ||
Makefile | ||
README.rst | ||
requirements.txt | ||
setup.py |
File renamed without changes.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))) | ||
#print(sys.path) | ||
|
||
import cnyeardb |
Binary file not shown.
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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#-*-coding:utf-8-*- | ||
from .context import cnyeardb | ||
|
||
Cnyeardb = cnyeardb.Cnyeardb | ||
Cnyear = cnyeardb.Cnyear | ||
|
||
|
||
if __name__ == '__main__': | ||
cnyeardb_handler = Cnyeardb() | ||
cnyear = Cnyear('清宣統六年') | ||
print(cnyeardb_handler.lkp_dnst('清',r'\b清\b',d1='後金·清')) | ||
print(cnyeardb_handler.lkp_rgnl('清','天聰',da=r'\b清\b')) | ||
print(cnyeardb_handler.lkp_dnst('清',da=r'\b清\b')) | ||
print(cnyeardb_handler.lkp_dnst('清')) | ||
print(cnyeardb_handler.mtch_dnst('三國吳')) | ||
print(cnyeardb_handler.mtch_dnst('南朝宋')) | ||
print(cnyeardb_handler.mtch_dnst('唐')) | ||
print(cnyeardb_handler.mtch_dnst('清')) | ||
print(cnyeardb_handler.mtch_rgnl('清乾隆十二年')) | ||
print(cnyeardb_handler.mtch_rgnl('清十二年')) | ||
print(cnyeardb_handler.mtch_rgnl('明建文元年')) | ||
print(cnyeardb_handler.mtch_rgnl('南明弘光二年')) | ||
print(cnyeardb_handler.lkp_dnst('明')) | ||
print(cnyeardb_handler.lkp_year(1922)) | ||
print(cnyeardb_handler.lkp_year(1822)) | ||
print(cnyeardb_handler.lkp_year(1522)) | ||
print(cnyeardb_handler.lkp_year(1644)) | ||
|
||
print(Cnyear('清宣統六年').y2cny()) | ||
print(Cnyear('明崇禎十八年').y2cny(ldefaultdy=['明','清','南明'])) | ||
print(Cnyear('明崇禎十八年').y2cny(ldefaultdy=['明','南明','清'],dig=True)) | ||
print(Cnyear('明崇禎十八年').y2cny(ldefaultdy=['明'],dig=True)) | ||
print(Cnyear('明崇禎17年').y2cny(ldefaultdy=['明','清'])) | ||
print(Cnyear('明崇禎十七年').y2cny(ldefaultdy=['清','明'],dig=True)) | ||
print(Cnyear('明崇禎間').y2cny(ldefaultdy=['清','明'])) | ||
print(Cnyear('民國間').y2cny(ldefaultdy=['清','明'])) | ||
print(Cnyear('民國三十八年').y2cny(ldefaultdy=['清','明'])) | ||
print(Cnyear('一九四九年').y2cny(ldefaultdy=['清','明'], dig=True)) | ||
|
||
def test_cnyear_y2cny(s, ldefaultdy=[], dig=False): | ||
r = Cnyear(s).y2cny(ldefaultdy=ldefaultdy, dig=dig) | ||
print(s, r) | ||
|
||
test_cnyear_y2cny('民國1年',dig=True) | ||
test_cnyear_y2cny('民國三十九年') | ||
test_cnyear_y2cny('民國三十八年') | ||
test_cnyear_y2cny('民國38年') | ||
test_cnyear_y2cny('1949年') | ||
test_cnyear_y2cny('1948年',dig=True) | ||
test_cnyear_y2cny('一九二三年') | ||
test_cnyear_y2cny('清宣統十八年') | ||
test_cnyear_y2cny('明崇禎十七年') | ||
test_cnyear_y2cny('清順治2年',dig=True) | ||
test_cnyear_y2cny('明崇禎二十八年',ldefaultdy=['明','清','南明']) | ||
test_cnyear_y2cny('明崇禎二十八年',ldefaultdy=['明','南明','清']) | ||
test_cnyear_y2cny('明崇禎二十八年',ldefaultdy=['明']) | ||
test_cnyear_y2cny('清宣統四十一年',ldefaultdy=['明'],dig=True) | ||
test_cnyear_y2cny('明宣統四十一年',ldefaultdy=['明']) | ||
test_cnyear_y2cny('民國上年',ldefaultdy=['明']) | ||
|
||
print('\n') | ||
x = Cnyear('明崇禎二十八年') | ||
print(x.get_year_realkind()) | ||
print(x.y2cny(ldefaultdy=['南明'])) | ||
print(x.y2cny(ldefaultdy=['清'])) | ||
print(x.get_year_realkind()) | ||
print(__name__) | ||
|
||
|