我正在尝试为list_of_word = [word1, word2, word3, word1]
项目视图实现缩放功能。这是我的代码:
from nltk.corpus import wordnet as wn
from itertools import product
def similarity(wordx,wordy):
sem1, sem2= wn.synsets(wordx), wn.synsets(wordy)
maxscore = 0
for i,j in list(product(*[sem1,sem2])):
score = i.path_similarity(j) # Wu-Palmer Similarity
maxscore = score if maxscore < score else maxscore
return maxscore
def group_high_similarity(target_list,tc):
result = target_list[:]
num_word = len(result)
for word in result:
wordx = word
i = 0
while i<len(result):
wordy = result[i]
value = similarity(wordx,wordy)
if value >= tc:
result[i] = wordx
if wordy != wordx :print wordy+"---> "+ wordx
i += 1
return result
问题是我的iCarousel
和NSString *pathToHDImage = [documentsFolderPath stringByAppendingPathComponent:solution.localHDURL];
if (!view) {
view = [[AsyncImageView alloc] initWithFrame:self.view.bounds];
view.contentMode = UIViewContentModeScaleAspectFit;
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
pinchGesture.cancelsTouchesInView = false;
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
panGesture.cancelsTouchesInView = false;
pinchGesture.delegate = panGesture.delegate = self;
[view addGestureRecognizer:pinchGesture];
[view addGestureRecognizer:panGesture];
((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage];
} else
((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage];
永远不会被调用。我能怎么做?主要目标是为每个handlePan:
项目视图实现缩放功能。