File tree Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: fuzzylogic
33description: Fuzzy Logic for Python 3
44license: MIT
55url: https://github.com/amogorkon/fuzzylogic
6- version: 0.1.1post3
6+ version: 0.1.1post5
77author: Anselm Kiefner
88author_email: fuzzylogic-pypi@anselm.kiefner.de
99python_requires: >3.6
Original file line number Diff line number Diff line change 11Metadata-Version: 2.1
22Name: fuzzylogic
3- Version: 0.1.1.post3
3+ Version: 0.1.1.post5
44Summary: Fuzzy Logic for Python 3
55Home-page: https://github.com/amogorkon/fuzzylogic
66Author: Anselm Kiefner
Original file line number Diff line number Diff line change 22"""
33Lingual hedges modify curves of membership values.
44
5- These work with sets only. It's more trouble than it is worth making
6- these work with pure functions, so meta-functionality was removed.
5+ These should work with Sets and functions.
76"""
87
98from .classes import Set
109
1110def very (g ):
1211 """Sharpen memberships so that only the values close 1 stay at the top."""
13- def s_f (g ):
12+ if isinstance (g , Set ):
13+ def s_f (g ):
14+ def f (x ):
15+ return g (x ) ** 2
16+ return f
17+ return Set (s_f (g .func ))
18+ else :
1419 def f (x ):
1520 return g (x ) ** 2
1621 return f
17- return Set (s_f (g .func ))
1822
1923
2024def plus (g ):
2125 """Sharpen memberships like 'very' but not as strongly."""
22- def s_f (g ):
26+ if isinstance (g , Set ):
27+ def s_f (g ):
28+ def f (x ):
29+ return g (x ) ** 1.25
30+ return f
31+ return Set (s_f (g .func ))
32+ else :
2333 def f (x ):
2434 return g (x ) ** 1.25
2535 return f
26- return Set (s_f (g .func ))
2736
2837
2938def minus (g ):
3039 """Increase membership support so that more values hit the top."""
31- def s_f (g ):
40+ if isinstance (g , Set ):
41+ def s_f (g ):
42+ def f (x ):
43+ return g (x ) ** 0.75
44+ return f
45+ return Set (s_f (g .func ))
46+ else :
3247 def f (x ):
3348 return g (x ) ** 0.75
34- return f
35- return Set (s_f (g .func ))
49+ return f
You can’t perform that action at this time.
0 commit comments